Revision: 7939
Author: xqt
Date: 2010-02-16 16:02:34 +0000 (Tue, 16 Feb 2010)
Log Message:
-----------
proxy support for rewrite (patch 2789651)
Modified Paths:
--------------
branches/rewrite/pywikibot/comms/threadedhttp.py
branches/rewrite/pywikibot/config2.py
Modified: branches/rewrite/pywikibot/comms/threadedhttp.py
===================================================================
--- branches/rewrite/pywikibot/comms/threadedhttp.py 2010-02-16 09:54:23 UTC (rev 7938)
+++ branches/rewrite/pywikibot/comms/threadedhttp.py 2010-02-16 16:02:34 UTC (rev 7939)
@@ -31,6 +31,7 @@
import sys
import pywikibot
+from pywikibot import config
logger = logging.getLogger("pywiki.comms.threadedhttp")
@@ -153,6 +154,8 @@
except KeyError:
self.connection_pool = ConnectionPool()
self.max_redirects = kwargs.pop('max_redirects', 5)
+ if len(args) < 3:
+ kwargs.setdefault('proxy_info', config.proxy)
httplib2.Http.__init__(self, *args, **kwargs)
def request(self, uri, method="GET", body=None, headers=None,
Modified: branches/rewrite/pywikibot/config2.py
===================================================================
--- branches/rewrite/pywikibot/config2.py 2010-02-16 09:54:23 UTC (rev 7938)
+++ branches/rewrite/pywikibot/config2.py 2010-02-16 16:02:34 UTC (rev 7939)
@@ -478,6 +478,18 @@
# foreign wiki, set cosmetic_changes_mylang_only to False, but be careful!
cosmetic_changes_mylang_only = True
+### Proxy configuration ###
+# assign prox = None to connect directly
+# For proxy support first run: apt-get install python-socks.py
+# then change your user-config.py like:
+# import httplib2
+# import socks
+# proxy = httplib2.ProxyInfo(socks.PROXY_TYPE_HTTP, 'localhost', 8000)
+# The following lines will be printed, but it works:
+# Configuration variable 'httplib2' is defined but unknown. Misspelled?
+# Configuration variable 'socks' is defined but unknown. Misspelled?proxy = None
+proxy = None
+
# End of configuration section
# ============================
# System-level and User-level changes.
Show replies by date