'http': 'http://{}:80'.format(host),
'https': 'http://{}:443'.format(host),
}
- return requests.get(url, timeout=5, proxies=proxies, allow_redirects=False)
+ headers = {'User-Agent': 'mirror-health'}
+ return requests.get(url, headers=headers, timeout=5, proxies=proxies, allow_redirects=False)
def last_modified(response):
lm = 0
logging.debug("lm for host %s: %s", host, lm)
if healthy(retrieve_from_host(host, HEALTH_CHECK_URL)):
latest_ts = max(latest_ts, lm)
- except (requests.exceptions.ProxyError, requests.exceptions.ReadTimeout, requests.exceptions.ConnectTimeout):
+ except (requests.exceptions.ProxyError, requests.exceptions.ReadTimeout, requests.exceptions.ConnectTimeout, requests.exceptions.ConnectionError):
pass
try:
local_lm = last_modified(retrieve_from_host('localhost', URL))
- except (requests.exceptions.ProxyError, requests.exceptions.ReadTimeout, requests.exceptions.ConnectTimeout):
+ except (requests.exceptions.ProxyError, requests.exceptions.ReadTimeout, requests.exceptions.ConnectTimeout, requests.exceptions.ConnectionError):
return False
logging.debug("lm for localhost: %s", local_lm)
if local_lm < latest_ts: