Skip to main content
 首页 » 编程设计

Python urllib 代理

2025年05月04日6jyk

我正在尝试通过 urllib 获取一些 url 并通过我的代理进行 Mechanize 。

使用 mechanize 我尝试以下操作:

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

我收到以下错误:

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. 

作为代理,用户名和密码是正确的,可能是什么问题?

请您参考如下方法:

也许代理正在使用 NTLM 身份验证?

如果是这种情况,您可以尝试使用 NTLM Authorization Proxy Server (另请参见 this answer)。