如何修复SSL错误握手错误10054“ WSAECONNRESET”

时间:2019-06-21 13:19:37

标签: python

我需要在网站“ https://en.sse.net.cn/indices/scfinew.jsp”上进行网上抓取。

我尝试使用请求库通过以下代码获取响应:

import requests
from bs4 import BeautifulSoup

response_cre=requests.get("https://en.sse.net.cn/indices/scfinew.jsp")

但是我得到这个错误:

Traceback (most recent call last):

  File "<ipython-input-64-0d94074c63e6>", line 1, in <module>
    response_scfi = requests.get("https://en.sse.net.cn/indices/scfinew.jsp")

  File "C:\Users\Nandha\Anaconda3\lib\site-packages\requests\api.py", line 75, in get
    return request('get', url, params=params, **kwargs)

  File "C:\Users\Nandha\Anaconda3\lib\site-packages\requests\api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)

  File "C:\Users\Nandha\Anaconda3\lib\site-packages\requests\sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)

  File "C:\Users\Nandha\Anaconda3\lib\site-packages\requests\sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)

  File "C:\Users\Nandha\Anaconda3\lib\site-packages\requests\adapters.py", line 514, in send
    raise SSLError(e, request=request)

SSLError: HTTPSConnectionPool(host='en.sse.net.cn', port=443): Max retries exceeded with url: /indices/scfinew.jsp (Caused by SSLError(SSLError("bad handshake: SysCallError(10054, 'WSAECONNRESET')")))

0 个答案:

没有答案