Skip to content

Commit 4f939b9

Browse files
committed
fix: Raise error on bad HTTP status code
1 parent cb15b5d commit 4f939b9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

templateflow/api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,8 @@ def _s3_get(filepath):
320320
print(f'Downloading {url}', file=stderr)
321321
# Streaming, so we can iterate over the response.
322322
r = requests.get(url, stream=True, timeout=TF_GET_TIMEOUT)
323+
if r.status_code != 200:
324+
raise RuntimeError(f'Failed to download {url} with status code {r.status_code}')
323325

324326
# Total size in bytes.
325327
total_size = int(r.headers.get('content-length', 0))

0 commit comments

Comments
 (0)