curl-and-python
pycurl NTLM proxy authentication settings
Date: Fri, 19 Oct 2007 11:04:06 -0400
Hi,
I am trying to use pycurl from a Windows XP machine to connect to the
internet through an NTLM proxy. Based on my readings of the libcurl
documentation, I believe that I have specified all of the correct
settings.
Here is the current version of my script:
==========
import pycurl
pycurl.global_init(pycurl.GLOBAL_WIN32)
pycurl.global_init(pycurl.GLOBAL_SSL)
x = pycurl.Curl()
####
# Define a callback function for logging.
def log(debug_type, debug_msg):
print "debug (%d): %s" % (debug_type, debug_msg),
#####
# Set cURL options.
x.setopt(pycurl.URL, "http://www.msn.com")
# NTLM proxy authentication.
x.setopt(pycurl.PROXY, "proxy_url")
x.setopt(pycurl.PROXYPORT, 80)
x.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_HTTP)
x.setopt(pycurl.PROXYAUTH, pycurl.HTTPAUTH_NTLM)
x.setopt(pycurl.PROXYUSERPWD, "domain\username:password")
# Print some (hopefully) useful messages
x.setopt(pycurl.VERBOSE, 1)
x.setopt(pycurl.DEBUGFUNCTION, log)
####
####
# Scrub!
try:
x.perform()
except:
print "Script failure, please check log messages.",
==========
When run, I get the following output:
==========
debug (0): Could not resolve host: www.msn.com (Domain name not found)
debug (0): Closing connection #0
Script failure, please check log messages.
==========
Based on these logs, it appears that pycurl is trying to connect
without even trying to connect to the proxy. I normally connect to
the web through this proxy via internet explorer, so I know that it is
working correctly.
I would appreciate if anyone could point me in the right direction on this.
Thanks,
Bill
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2007-10-19