You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
39 lines
1.1 KiB
https://github.com/dae/anki/issues/1
|
|
|
|
--- libanki/anki/sync.py
|
|
+++ libanki/anki/sync.py
|
|
@@ -16,6 +16,15 @@
|
|
HTTP_TIMEOUT = 30
|
|
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
|
|
######################################################################
|
|
|
|
@@ -42,7 +51,7 @@
|
|
def _setupProxy():
|
|
global HTTP_PROXY
|
|
# set in env?
|
|
- p = httplib2.ProxyInfo.from_environment()
|
|
+ p = _proxy_info_from_environment()
|
|
if not p:
|
|
# platform-specific fetch
|
|
url = None
|
|
@@ -59,7 +68,7 @@
|
|
elif 'http' in r:
|
|
url = r['http']
|
|
if url:
|
|
- p = httplib2.ProxyInfo.from_url(url, _proxyMethod(url))
|
|
+ p = _proxy_info_from_url(url, _proxyMethod(url))
|
|
HTTP_PROXY = p
|
|
|
|
def _proxyMethod(url):
|