mirror-health: set User-Agent http header
authorJulien Cristau <jcristau@debian.org>
Fri, 23 Feb 2018 15:21:06 +0000 (16:21 +0100)
committerJulien Cristau <jcristau@debian.org>
Fri, 23 Feb 2018 15:21:06 +0000 (16:21 +0100)
modules/roles/files/mirror_health/mirror-health

index 2c582f2..bbd4c27 100755 (executable)
@@ -21,7 +21,8 @@ def retrieve_from_host(host, url):
         'http': 'http://{}:80'.format(host),
         'https': 'http://{}:443'.format(host),
     }
         '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
 
 def last_modified(response):
     lm = 0