473,396 Members | 1,996 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,396 software developers and data experts.

Pycurl proxy authentication anyone?

I've been trying to get a simple pycurl script working with an
authenticating proxy, here is the code (with changes to protect the
guilty!):

from pycurl import *
import StringIO

b = StringIO.StringIO()
c = Curl()

c.setopt(URL, "http://www.google.com/")
c.setopt(VERBOSE,1)
c.setopt(HTTPHEADER, ["User-Agent: Mozilla/5.001 (windows; U; NT4.0;
en-us) Gecko/25250101", "Agent: "])
c.setopt(PROXY, "dummyproxy")
c.setopt(PROXYPORT,80)
c.setopt(PROXYUSERPWD,"dummyuser:dummypasswd")
c.setopt(HTTPAUTH,8) #NTLM
c.setopt(WRITEFUNCTION, b.write)
c.setopt(FOLLOWLOCATION, 1)
c.setopt(MAXREDIRS, 5)

c.perform()
print b.getvalue()

And I get....

* About to connect() to dummyproxy:80
* Connected to dummyproxy (10.10.10.10) port 80
GET http://www.google.com/ HTTP/1.1

Proxy-authorization: Basic ZHVtbXl1c2VyOmR1bW15cGFzc3dk
Authorization: NTLM TlRMTVNTUAABAAAAAgIAAAAAAAAgAAAAAAAAACAAAAA=
Host: www.google.com
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
User-Agent: Mozilla/5.001 (windows; U; NT4.0; en-us) Gecko/25250101

< HTTP/1.1 407 Proxy authentication required
< Proxy-Authenticate: NTLM
< Proxy-Connection: close
< Content-Length: 503
< Content-Type: text/html
* Connection #0 left intact
<html><head><title>Error 407</title>

<meta name="robots" content="noindex">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=iso-8859-1"></head>

<body>

<h2>HTTP Error 407</h2>

<p><strong>407 Proxy Authentication Required</strong></p>

<p>You must authenticate with a proxy server before this request can be
service
nd then try again.</p>

<p>Please contact the Web server's administrator if this problem
persists.</p>

</body></html>
* Closing connection #0

The username:password combo are correct.

I'm stumped! suggestions gratefully accepted..

Mark.

Jul 18 '05 #1
1 6303
Mark Ferguson <ma***********@newellandbudge.com> schreef:
I've been trying to get a simple pycurl script working with an
authenticating proxy, here is the code (with changes to protect the
guilty!): c.setopt(PROXYPORT,80)
c.setopt(PROXYUSERPWD,"dummyuser:dummypasswd")
c.setopt(HTTPAUTH,8) #NTLM


Shouldn't that last line be:

c.setopt(PROXYAUTH,8) #NTLM

--
JanC

"Be strict when sending and tolerant when receiving."
RFC 1958 - Architectural Principles of the Internet - section 3.9
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

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....
2
by: John | last post by:
Hi I am trying to access a web service from a desktop app which is running behind an ISA Server (Windows 2003 network). The desktop app fails with the message 'The request failed with HTTP...
1
by: Andrew | last post by:
Hi All In the .NET Framework is there any way to provide the proxy authentication the way internet explorer prompts. I mean when I access the net using internet explorer it asks for the...
2
by: rcp | last post by:
Hi all, I've read all posts from all existing threads and none of them worked to solve my problem, although its exactly the same. I'll try to explain my case and see if a kind soul could help me...
2
by: =?Utf-8?B?U2ltb25EZXY=?= | last post by:
Hi I have a utility class, called MailHandler, that I wrote to read and operate on emails on an Exchange server using WebDAV. The WebDAV SQL statements are sent using an HttpWebRequest object....
0
by: The Frog | last post by:
Hi everyone, I need a little help with a Proxy Server Authentication problem. When I try and use the Help -Search I get a 407 error saying that proxy authentication has failed. Does anyone know...
1
by: =?Utf-8?B?Z2FsbGFu?= | last post by:
We have an application that is running fine on several of our customer’s servers. However, one of our customers is having a problem running the application. The application works on one of his...
0
by: Sahasranaman | last post by:
Hi I am behind a proxy server that needs proxy authentication. There are a lot of libraries that come without proxy support. The function below, which is part of the python-twitter library does...
2
by: krishnakrish | last post by:
Hi, My name is krishna. I am using asp.net 2.0 with C#. I amusing Windows XP professional as OS. When I post some data to an external web server I get the error as "The Remote server returned an...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.