我很熟悉我应该将HTTP_RPOXY环境变量设置为代理地址.
一般urllib工作正常,问题是处理urllib2.
>>> urllib2.urlopen("http://www.google.com").read()
Run Code Online (Sandbox Code Playgroud)
回报
urllib2.URLError: <urlopen error [Errno 10061] No connection could be made because the target machine actively refused it>
Run Code Online (Sandbox Code Playgroud)
要么
urllib2.URLError: <urlopen error [Errno 11004] getaddrinfo failed>
Run Code Online (Sandbox Code Playgroud)
我试过@Fenikso的答案,但我现在收到这个错误:
URLError: <urlopen error [Errno 10060] A connection attempt failed because the
connected party did not properly respond after a period of time, or established
connection failed because connected host has failed to respond>
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?