curl-and-python

Re: pycurl NTLM proxy authentication settings

From: Kjetil Jacobsen <kjetilja_at_gmail.com>
Date: Sun, 21 Oct 2007 22:10:45 +0200

hi,

i would be suprised if this was a pycurl issue - are you able to to
connect using a curl commandline instead of pycurl?

if so, you can dump the libcurl options set for the corresponding
commandline options by using the '--libcurl' commandline option.
perhaps this reveals if there are options set by curl that are missing
from your code.

regards,
    - kjetil

On 10/19/07, wkranec_at_gmail.com <wkranec_at_gmail.com> wrote:
> 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
>
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2007-10-21