Commits

Sebastian Wiesner  committed 0957d57

#122: proxy support for intersphinx

  • Participants
  • Parent commits cd18cd4

Comments (0)

Files changed (2)

File doc/ext/intersphinx.rst

    ``http://docs.python.org/dev``.  It is up to you to update the inventory file
    as new objects are added to the Python documentation.
 
+   When fetching remote inventory files, proxy settings will be read from
+   the ``$HTTP_PROXY`` environment variable.
+
 .. confval:: intersphinx_cache_limit
 
    The maximum number of days to cache remote inventories.  The default is

File sphinx/ext/intersphinx.py

 """
 
 import time
-import urllib
+import urllib2
 import posixpath
 from os import path
 
 from sphinx.builders.html import INVENTORY_FILENAME
 
 
+urllib2.install_opener(urllib2.build_opener(
+    urllib2.ProxyHandler(), urllib2.HTTPRedirectHandler(),
+    urllib2.HTTPHandler(), urllib2.HTTPSHandler()))
+
+
 def fetch_inventory(app, uri, inv):
     """Fetch, parse and return an intersphinx inventory file."""
     invdata = {}
     localuri = uri.find('://') == -1
     try:
         if inv.find('://') != -1:
-            f = urllib.urlopen(inv)
+            f = urllib2.urlopen(inv)
         else:
             f = open(path.join(app.srcdir, inv))
     except Exception, err: