簡體   English   中英

Python- Urllib2:[Errno 54]對等重置連接

[英]Python- Urllib2: [Errno 54] Connection reset by peer

使用Urllib2時出現以下錯誤:

[Errno 54]對等重置連接

這是代碼:

import urllib2   
url = "https://api.thousandeyes.com/";
response = urllib2.urlopen(url, context=ctx);

這是錯誤:

nnayar$ python test2.py
OpenSSL 0.9.8zh 14 Jan 2016
Traceback (most recent call last):
  File "test2.py", line 13, in <module>
    response = urllib2.urlopen(url);
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 431, in open
    response = self._open(req, data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 449, in _open
    '_open', req)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1240, in https_open
    context=self._context)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1197, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 54] Connection reset by peer>

如何解決此問題?

該API最近不推薦使用TLS 1.0支持,這導致了該問題。 我現在正在努力將python升級為使用TLS1.2,這也非常具有挑戰性,因為Mac默認安裝的Python僅支持TLS 1.0。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM