0

The following curl works:

curl -vx proxy.example.com:8010 -U user:pass http://example.com

And returns valid content with response code of 200.

However, the same credentials used via python requests library yields a 407 status code (authentication error). Upon looking at the logs, it looks like the user is never passed through (is undefined).

url = "http://example.com"
proxies = {'http': 'http://proxy.example.com:8010'}
auth = HTTPProxyAuth("user", "pass")

resp = requests.get(url, proxies=proxies, auth=auth)

I am using requests library 2.3.0.

Delos Chang
  • 1,823
  • 3
  • 27
  • 47
  • 1
    Perhaps your proxy uses not Basic Authentication but Digest Authentication instead? See [How to pass proxy-authentication (requires digest auth) by using python requests module](http://stackoverflow.com/q/13506455) – Martijn Pieters Sep 24 '14 at 18:28

1 Answers1

2

Ultimately, the problem was solved by using "https" instead of "http" in the URL.

I can only speculate as to why this was the solution: perhaps it was a different version of the requests library or some bug? I will be looking into the issues to see why this worked.

Delos Chang
  • 1,823
  • 3
  • 27
  • 47