469,364 Members | 2,398 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,364 developers. It's quick & easy.

Add NTLM proxy authentication to urllib2

Hi,
I have to make internet connections through an ISA proxy server that
use NTLM or Kerberos authorization method.
I've found a program in python called ntlmaps that act like a proxy and
could make the NTLM authentication, but you have to run it and make all
your connection through it, not an optimal solution.
So what I really need is an enhanced urllib2 that support NTLM or
Kerberos.
I've found that pywin32 could manage NTLM encryption with the sspi
module but I've no idea how to implement it in urllib2, NTLM
authentication use a 'Token dance' between client and server.

Anyone has an experience, a demo or an idea to share ?

Thanks.

Sep 5 '06 #1
4 8073
looping napisał(a):
I have to make internet connections through an ISA proxy server that
use NTLM or Kerberos authorization method.
I've found a program in python called ntlmaps that act like a proxy and
could make the NTLM authentication, but you have to run it and make all
your connection through it, not an optimal solution.
So what I really need is an enhanced urllib2 that support NTLM or
Kerberos.
I've found that pywin32 could manage NTLM encryption with the sspi
module but I've no idea how to implement it in urllib2, NTLM
authentication use a 'Token dance' between client and server.

Anyone has an experience, a demo or an idea to share ?
Look at NTLM APS (http://ntlmaps.sourceforge.net/), Dimitry did this
already (although not in urllib).

--
Jarek Zgoda
http://jpa.berlios.de/
Sep 5 '06 #2
Jarek Zgoda <jz****@o2.usun.plwrites:
looping napisaƂ(a):
I have to make internet connections through an ISA proxy server that
use NTLM or Kerberos authorization method.
I've found a program in python called ntlmaps that act like a proxy and
could make the NTLM authentication, but you have to run it and make all
your connection through it, not an optimal solution.
So what I really need is an enhanced urllib2 that support NTLM or
Kerberos.
I've found that pywin32 could manage NTLM encryption with the sspi
module but I've no idea how to implement it in urllib2, NTLM
authentication use a 'Token dance' between client and server.

Anyone has an experience, a demo or an idea to share ?

Look at NTLM APS (http://ntlmaps.sourceforge.net/), Dimitry did this
already (although not in urllib).
I *think* I remember somebody did implement NTLM for urllib2. Keep
googling^W employing popular internet free-text search facilities.

But probably a proxy server like the one Jarek mentions is a much more
practical way to go.
John
Sep 7 '06 #3
Thanks for the answers.

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 ?

Sep 8 '06 #4
"looping" <ka****@gmail.comwrites:
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

Sep 8 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by O. Koch | last post: by
2 posts views Thread by Andre Bocchini | last post: by
reply views Thread by Carl Waldbieser | last post: by
1 post views Thread by Ray Slakinski | last post: by
4 posts views Thread by vooose | last post: by
6 posts views Thread by Tom | last post: by
2 posts views Thread by =?Utf-8?B?TGVuc3Rlcg==?= | last post: by
6 posts views Thread by Larry Hale | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.