Open GoogleCodeExporter opened 9 years ago
Accepting. This will be addressed post-0.6 with the HTTP layer rewrite.
Original comment by dclinton
on 21 Feb 2009 at 5:29
I have python-twitter 0.6; how does one setup using an HTTP proxy and
authentication?
Original comment by adamtaun...@gmail.com
on 8 Dec 2009 at 2:03
Original comment by bear42
on 16 May 2010 at 11:40
Change _GetOpener function in twitter.py with :
def _GetOpener(self, url, username=None, password=None):
proxies = {'http': 'http://USERNAME:PASSWORD@PROXY_SERVER:80/'}
proxyHandler = self._urllib.ProxyHandler(proxies)
if username and password:
self._AddAuthorizationHeader(username, password)
handler = self._urllib.HTTPBasicAuthHandler()
(scheme, netloc, path, params, query, fragment) = urlparse.urlparse(url)
handler.add_password(Api._API_REALM, netloc, username, password)
opener = self._urllib.build_opener(handler, proxyHandler)
else:
opener = self._urllib.build_opener(proxyHandler)
opener.addheaders = self._request_headers.items()
return opener
for non http proxies, replace http with respective proxy
Original comment by hasanatk...@gmail.com
on 28 Jun 2010 at 11:07
Here is the final twitter.py, look into documentation (of Api class) to see how
to use it with proxy.
Original comment by hasanatk...@gmail.com
on 28 Jun 2010 at 8:13
Attachments:
Original issue reported on code.google.com by
m.s.saha...@gmail.com
on 26 Oct 2008 at 12:56