From 913efc47d11b920c5137792a1d984ab82e1656d4 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Wed, 1 Aug 2018 14:00:33 +0200 Subject: [PATCH] Raise error for non-200 codes in download_file Fixes: https://pagure.io/koji/issue/1020 --- cli/koji_cli/lib.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cli/koji_cli/lib.py b/cli/koji_cli/lib.py index 02c6fd2d..33b4a096 100644 --- a/cli/koji_cli/lib.py +++ b/cli/koji_cli/lib.py @@ -498,6 +498,8 @@ def download_file(url, relpath, quiet=False, noprogress=False, size=None, num=No with closing(requests.get(url, stream=True)) as response: + # raise error if occured + response.raise_for_status() length = response.headers.get('content-length') f = open(relpath, 'wb') if length is None: