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
|
``http://docs.python.org/dev``. It is up to you to update the inventory file
|
||||||
as new objects are added to the Python documentation.
|
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
|
.. confval:: intersphinx_cache_limit
|
||||||
|
|
||||||
The maximum number of days to cache remote inventories. The default is
|
The maximum number of days to cache remote inventories. The default is
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import urllib
|
import urllib2
|
||||||
import posixpath
|
import posixpath
|
||||||
from os import path
|
from os import path
|
||||||
|
|
||||||
@ -34,6 +34,11 @@ from docutils import nodes
|
|||||||
from sphinx.builders.html import INVENTORY_FILENAME
|
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):
|
def fetch_inventory(app, uri, inv):
|
||||||
"""Fetch, parse and return an intersphinx inventory file."""
|
"""Fetch, parse and return an intersphinx inventory file."""
|
||||||
invdata = {}
|
invdata = {}
|
||||||
@ -42,7 +47,7 @@ def fetch_inventory(app, uri, inv):
|
|||||||
localuri = uri.find('://') == -1
|
localuri = uri.find('://') == -1
|
||||||
try:
|
try:
|
||||||
if inv.find('://') != -1:
|
if inv.find('://') != -1:
|
||||||
f = urllib.urlopen(inv)
|
f = urllib2.urlopen(inv)
|
||||||
else:
|
else:
|
||||||
f = open(path.join(app.srcdir, inv))
|
f = open(path.join(app.srcdir, inv))
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
|
Loading…
Reference in New Issue
Block a user