Add NTLM proxy authentication to urllib2

John J. Lee jjl at pobox.com
Fri Sep 8 13:53:57 EDT 2006


"looping" <kadeko at gmail.com> writes:

> I've done some tests with urllib2 and pywin32 and managed to partialy
> implement the NTLM authentication, but it look like you need a
> persistent connection (http 1.1 or 'Keep-Alive') to complete the
> authentication.
> Unfortunatly, urllib2 use a new connection for each request and
> changing this behavior look difficult.
> So I will probably write my own library.
> 
> Maybe there is something to do with the urlgrabber module ?

urlgrabber does indeed claim to do persistent connections in a way at
least somewhat integrated with urllib2.

I think I must have imagined there being an NTLM impl. for urllib2,
because ISTR you're right about needing a persistent connection.

I don't think it's too hard to fix urllib2 to reuse connections, but I
forget exactly why it doesn't do it already...


John




More information about the Python-list mailing list