mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
#122: proxy support for intersphinx
This commit is contained in:
parent
5469dfe4e6
commit
73942678c8
@ -60,6 +60,9 @@ linking:
|
||||
``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
|
||||
|
@ -25,7 +25,7 @@
|
||||
"""
|
||||
|
||||
import time
|
||||
import urllib
|
||||
import urllib2
|
||||
import posixpath
|
||||
from os import path
|
||||
|
||||
@ -34,6 +34,11 @@ from docutils import nodes
|
||||
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 = {}
|
||||
@ -42,7 +47,7 @@ def fetch_inventory(app, uri, inv):
|
||||
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:
|
||||
|
Loading…
Reference in New Issue
Block a user