fix(cli): fix 416 response code

This commit is contained in:
tretrauit 2024-02-06 14:24:15 +07:00
parent c2f81637e2
commit fa011a11a1

View File

@ -74,9 +74,9 @@ def download(url, out: Path, file_len: int = None, overwrite: bool = False) -> b
out.touch() out.touch()
# Streaming, so we can iterate over the response. # Streaming, so we can iterate over the response.
response = requests.get(url=url, headers=headers, stream=True) response = requests.get(url=url, headers=headers, stream=True)
response.raise_for_status()
if response.status_code == 416: if response.status_code == 416:
return return True
response.raise_for_status()
# Sizes in bytes. # Sizes in bytes.
total_size = int(response.headers.get("content-length", 0)) total_size = int(response.headers.get("content-length", 0))
block_size = 32768 block_size = 32768