开发者

Python urllib proxy

I'm trying to fetch some urls via urllib and mechanize through my proxy.

With mechanize I try the following:

from mechanize import Browser
import re

br = Browser()
br.set_proxies({"http": "MYUSERNAME:*******@itmalsproxy.italy.local:8080"})
br.open("http://www.example.com/")

I get the following error:

httperror_seek_wrapper: HTTP Error 407: Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy service is denied.

As the proxy, the username and the password are correct, what could be the pro开发者_JAVA技巧blem?


Maybe the proxy is using NTLM authentication?

If that is the case, you can try using the NTLM Authorization Proxy Server (see also this answer).


you might get more info from the response headers

print br.response().info()


When your web browser uses proxy server to surf the Web from within your local network your may be required to authenticate youself to use proxy. Google ntlmaps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜