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

How can I setup proxy of urllib2 properly

P: n/a
I got some source code form python's help document. the below:

proxy_handler = urllib2.ProxyHandler({'http':
proxy_auth_handler = urllib2.HTTPBasicAuthHandler()
proxy_auth_handler.add_password('realm', 'host', 'username',
^^^^^^^ ^^^^^

opener = urllib2.build_opener(proxy_handler, proxy_auth_handler)
# This time, rather than install the OpenerDirector, we use it

I have only the username and password of proxy server. But I do not
know what should I provide for the 'realm' and 'host' prameters of
add_password function.

for example,
My proxy server is ""
username is "user1"
password is "pass1"

how can I provide parameters for "add_password" function?

Nov 2 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.