From 12a7f65e6b89af63df08b023fab4ed53a5313e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= Date: Mon, 25 Jun 2012 13:27:20 +0200 Subject: [PATCH] Override urllib2 default user-agent --- installsystems/tools.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/installsystems/tools.py b/installsystems/tools.py index 452c4d8..c6a2dd4 100644 --- a/installsystems/tools.py +++ b/installsystems/tools.py @@ -139,7 +139,10 @@ class PipeFile(object): Open a file accross an http server ''' try: - self.fo = urllib2.urlopen(path, timeout=self.timeout) + headers = {"User-Agent": "%s v%s" % (installsystems.canonical_name, + installsystems.version)} + request = urllib2.Request(path, None, headers) + self.fo = urllib2.urlopen(request, timeout=self.timeout) except Exception as e: raise ISError("Unable to open %s" % path, e) # get file size -- GitLab