diff options
-rw-r--r-- | cloudinit/url_helper.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cloudinit/url_helper.py b/cloudinit/url_helper.py index c5921147..93df2510 100644 --- a/cloudinit/url_helper.py +++ b/cloudinit/url_helper.py @@ -130,12 +130,12 @@ def readurl(url, data=None, timeout=None, retries=0, for _i in range(0, manual_tries): try: r = requests.request(**req_args) + if check_status: + r.raise_for_status() except exceptions.RequestException as e: last_excp = [e] if last_excp: raise last_excp[-1] - if check_status: - r.raise_for_status() return UrlResponse(r.status_code, r.content, r.headers) |