By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,522 Members | 1,770 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,522 IT Pros & Developers. It's quick & easy.

Proxy authentication in common libraries

P: n/a
Hi

I am behind a proxy server that needs proxy authentication. There are
a lot of libraries that come without proxy support. The function
below, which is part of the python-twitter library does HTTP
Authentication, and I can't figure out how to do this with a
ProxyBasicAuthHandler object. I'm pasting the function here. Can
someone tell me how this code can be rewritten to do proxy
authentication as well as http authentication?

def _GetOpener(self, url, username=None, password=None):
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)
else:
opener = self._urllib.build_opener()
opener.addheaders = self._request_headers.items()
return opener
Oct 26 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.