fh = urllib.urlopen('https://docs.python.org/2/library/urllib.html',proxies=proxies)
其中proxies是一个字典,如下所示:
proxies['http'] = "http//user_name:password@ip:port"
proxies['https'] = "https//user_name:password@ip:port"
NOte:我在http和https之后删除了冒号,因为它被视为一个链接,我不允许发布超过2个链接。
但我得到以下错误:
407 def _real_connect(self, addr, return_errno):
IOError: [Errno socket error] [Errno 1] _ssl.c:510: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
我尝试了#34; Python httplib SSL23_GET_SERVER_HELLO:unknown protocol"但这给了我以下错误:
407 def _real_connect(self, addr, return_errno):
IOError: [Errno socket error] [Errno 8] _ssl.c:510: EOF occurred in violation of protocol
现在可能是因为大学代理,但我通过代理提供了它。
答案 0 :(得分:3)
您错过了URI中的:
:
proxies['http'] = "http://user_name:password@ip:port"
proxies['https'] = "https://user_name:password@ip:port"