Using urlopen with a proxy server requiring authentication

Moshe Zadka moshez at zadka.site.co.il
Mon Apr 2 13:35:24 EDT 2001


On 2 Apr 2001 16:01:29 GMT, dick.streefland at tasking.com (Dick Streefland) wrote:
 
> For a proxy authorization, you need to send an additional
> "Proxy-authorization" header with the base64 "encryption" of your
> username and password. I don't think you can do that with urllib,
> but you can use the httplib module instead:
> 
>   import binascii
>   cookie = binascii.b2a_base64("username:password")
>   ...
>   h.putheader('Proxy-authorization', 'Basic %s' % cookie)

Or use 2.1's urllib2 which support Proxy authentication easily and
transparently.
-- 
"I'll be ex-DPL soon anyway so I'm        |LUKE: Is Perl better than Python?
looking for someplace else to grab power."|YODA: No...no... no. Quicker,
   -- Wichert Akkerman (on debian-private)|      easier, more seductive.
For public key, finger moshez at debian.org  |http://www.{python,debian,gnu}.org




More information about the Python-list mailing list