(Caused by SSLError(SSLError(1, ‘[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)‘)))

You want to use Python’s request library to call the company interface and create some data, but you finally report an error

Traceback (most recent call last):
  File "D:\My_Python\LeetCode\debug.py", line 38, in <module>
    res = requests.post(url,headers=headers,json=json_data,verify = False)
  File "C:\Users\lisq\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "C:\Users\lisq\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\lisq\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\lisq\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\lisq\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='dyyy.chinacaring.com', port=18081): Max retries exceeded with url: /api/test/ehospital/confirmed (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)')))

I searched many methods on the Internet and tried to verify = false, but it didn’t work.
finally, I found that it was because my packet capture tool was on, because I first used the packet capture tool to catch the interface, and then used the requests library to operate. The packet capture tool Charles was not off.
just turn off the packet capture tool


Read More: