else:
error, http_status_code, resp_headers, content = \
await self.get(url, req_headers)
- if error is not None and (
- not url_host.startswith('localhost') and
- not url_host.startswith('127.')
- ):
+ if error is None or \
+ url_host.startswith('localhost') or \
+ url_host.startswith('127.'):
+ use_proxy = False
+ else:
self.log(' Error : %s' % error)
- if use_proxy and http_status_code != 404:
- self.log(' Retrying with the proxy...')
- error, http_status_code, resp_headers, content = \
- await self.get(url, req_headers, use_proxy=True)
- if error is None:
- self.proxy_ok.add(url_host)
+ if use_proxy:
+ if http_status_code == 404:
+ use_proxy = False
+ else:
+ self.log(' Retrying with the proxy...')
+ error, http_status_code, resp_headers, content = \
+ await self.get(url, req_headers, use_proxy=True)
+ if error is None:
+ self.proxy_ok.add(url_host)
if (error is not None) or (
http_status_code and (http_status_code >= 400)
):