Commits

phillip.eby  committed c1a72e1

EasyInstall now includes setuptools version information in the
``User-Agent`` string sent to websites it visits. (backport from trunk)

  • Participants
  • Parent commits e32cabc
  • Branches setuptools-0.6

Comments (0)

Files changed (2)

File EasyInstall.txt

 Release Notes/Change History
 ============================
 
+0.6c1
+ * EasyInstall now includes setuptools version information in the
+   ``User-Agent`` string sent to websites it visits.
+
 0.6b4
  * Fix creating Python wrappers for non-Python scripts
 

File setuptools/package_index.py

             if match:
                 yield urlparse.urljoin(url, match.group(1))
 
-
-
-
+user_agent = "Python-urllib/%s setuptools/%s" % (
+    urllib2.__version__, require('setuptools')[0].version
+)
 
 
 
         if url.startswith('file:'):
             return local_open(url)
         try:
-            return urllib2.urlopen(url)
+            request = urllib2.Request(url)
+            request.add_header('User-Agent', user_agent)
+            return urllib2.urlopen(request)
         except urllib2.HTTPError, v:
             return v
         except urllib2.URLError, v:
             raise DistutilsError("Download error: %s" % v.reason)
 
-
     def _download_url(self, scheme, url, tmpdir):
         # Determine download filename
         #
             else:
                 return filename
 
-
     def scan_url(self, url):
         self.process_url(url, True)