Improve error handling in case of HTTP errors

In case of a HTTP status code 404, the returned 'r' was never assigned.
In case of URL errors which are not timeouts, we probably should bail
out.
This commit is contained in:
Enrico Tröger
2015-10-21 22:40:34 +02:00
parent fe162eedd5
commit 534145d178

View File

@@ -304,8 +304,11 @@ def _get_response(request, auth, template):
r = urllib2.urlopen(request)
except urllib2.HTTPError as exc:
errors, should_continue = _request_http_error(exc, auth, errors) # noqa
r = exc
except urllib2.URLError:
should_continue = _request_url_error(template, retry_timeout)
if not should_continue:
raise
if should_continue:
continue