mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
patch for httplib2 change from Arfrever
This commit is contained in:
parent
aad22e4ef9
commit
e2c4fd5945
1 changed files with 11 additions and 2 deletions
13
anki/sync.py
13
anki/sync.py
|
@ -13,6 +13,15 @@ from hooks import runHook
|
||||||
HTTP_TIMEOUT = 30
|
HTTP_TIMEOUT = 30
|
||||||
HTTP_PROXY = None
|
HTTP_PROXY = None
|
||||||
|
|
||||||
|
try:
|
||||||
|
# httplib2 >=0.7.7
|
||||||
|
_proxy_info_from_environment = httplib2.proxy_info_from_environment
|
||||||
|
_proxy_info_from_url = httplib2.proxy_info_from_url
|
||||||
|
except AttributeError:
|
||||||
|
# httplib2 <0.7.7
|
||||||
|
_proxy_info_from_environment = httplib2.ProxyInfo.from_environment
|
||||||
|
_proxy_info_from_url = httplib2.ProxyInfo.from_url
|
||||||
|
|
||||||
# Httplib2 connection object
|
# Httplib2 connection object
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
@ -40,7 +49,7 @@ def httpCon():
|
||||||
def _setupProxy():
|
def _setupProxy():
|
||||||
global HTTP_PROXY
|
global HTTP_PROXY
|
||||||
# set in env?
|
# set in env?
|
||||||
p = httplib2.ProxyInfo.from_environment()
|
p = _proxy_info_from_environment()
|
||||||
if not p:
|
if not p:
|
||||||
# platform-specific fetch
|
# platform-specific fetch
|
||||||
url = None
|
url = None
|
||||||
|
@ -57,7 +66,7 @@ def _setupProxy():
|
||||||
elif 'http' in r:
|
elif 'http' in r:
|
||||||
url = r['http']
|
url = r['http']
|
||||||
if url:
|
if url:
|
||||||
p = httplib2.ProxyInfo.from_url(url, _proxyMethod(url))
|
p = _proxy_info_from_url(url, _proxyMethod(url))
|
||||||
HTTP_PROXY = p
|
HTTP_PROXY = p
|
||||||
|
|
||||||
def _proxyMethod(url):
|
def _proxyMethod(url):
|
||||||
|
|
Loading…
Reference in a new issue