473,405 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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 8469
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: O. Koch | last post by:
Until now, i know that ftplib doesn't support proxies and that i have to use urllib2. But i don't know how to use the urllib2 correct. I found some examples, but i don't understand them. Is...
2
by: Andre Bocchini | last post by:
I'm having some trouble using proxy authentication. I can't figure out how to authenticate with a Squid proxy. I know for a fact the proxy is using Basic instead of Digest for the authentication....
0
by: Carl Waldbieser | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** When using urllib2.urlopen() on my Windows 2000 machine at work, I was puzzled that I kept getting back authentication errors from...
1
by: Ray Slakinski | last post by:
Hello, I have defined a function to set an opener for urllib2, this opener defines any proxy and http authentication that is required. If the proxy has authencation itself and requests an...
4
by: vooose | last post by:
Consider accessing a webpage through a proxy server: WebRequest request = WebRequest.Create("http://somepage.com"); WebProxy proxy = new WebProxy(proxyHost, proxyPort); proxy.Credentials = new...
6
by: Tom | last post by:
Hi, I have activated NTLM authentication on IIS on Windows 2003, and the log files show that for each request, three or four hits are generated. Typically, the first and second hit get a 401...
2
by: Haxan | last post by:
Hi, I have an unmanaged C++ dll that consumes a web service using NTLM proxy authentication. I was able to consume the web service and get the results when using .Net runtime 1.1. When I...
2
by: =?Utf-8?B?TGVuc3Rlcg==?= | last post by:
A C# (.NET 2) application which uses the System.Net.HttpWebRequest object to request a resource over HTTPS is failing following the installation of a new proxy server on our internal network with...
6
by: Larry Hale | last post by:
Greetings, Pythonistas! My employer has a Squid Proxy between my Python programs and The Internet. I've searched high-and-low, and can only find examples online of how to do basic...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.