Proxy Authentication??

jepler epler jepler.lnk at lnk.ispi.net
Sun Aug 20 10:45:06 EDT 2000


On Sun, 20 Aug 2000 21:37:11 +1000, Steven Adams
 <adams_s at lab.eng.usyd.edu.au> wrote:
>Hi all,
>
>does anyone know how to get a python script to deal with proxy servers that
>require authentication (username,password)?

Unfortunately, there is no provision in urllib for proxy authentication.
I thought I had a patch to provide this, but it appears that I do not.

Python's urllib will send authentication, just not proxy authentication,
by the following line in urllib.py (around line 260 in my 1.5.2 version):
        if auth: h.putheader('Authorization', 'Basic %s' % auth)
read the surrounding code to understand how the string 'auth' is put together,
construct the 'pauth' string as appropriate, and then add a line to
	if pauth: h.putheader('Proxy-Authorization', 'Basic %s' % pauth)

For more details, you'll probably have to resort to the specification for HTTP
itself.

Best of luck!

Jeff



More information about the Python-list mailing list