我知道以前也问过类似的问题,但似乎没有一个答案对我有效。我看到的每个答案都是由代理格式引起的
这个错误不是因为代理,正如你所看到的,我没有使用任何代理,但仍然出现了这个错误
我使用的是python 3.9.8
当用请求库在python中发布或获取请求时,它会向我抛出这个错误…
它几个小时前还可以工作。
我想尽一切办法来解决这个错误,但似乎都无济于事。我甚至重新安装了我的python和所有东西,但它仍然是一样的。
这是get请求:r = requests.get("https://www.fedex.com/en-us/home.html")
File "C:UsersPC-HynekAppDataLocalProgramsPythonPython39libsite-packagesurllib3connectionpool.py", line 696, in urlopen
self._prepare_proxy(conn)
File "C:UsersPC-HynekAppDataLocalProgramsPythonPython39libsite-packagesurllib3connectionpool.py", line 964, in _prepare_proxy
conn.connect()
File "C:UsersPC-HynekAppDataLocalProgramsPythonPython39libsite-packagesurllib3connection.py", line 364, in connect
conn = self._connect_tls_proxy(hostname, conn)
File "C:UsersPC-HynekAppDataLocalProgramsPythonPython39libsite-packagesurllib3connection.py", line 501, in _connect_tls_proxy
socket = ssl_wrap_socket(
File "C:UsersPC-HynekAppDataLocalProgramsPythonPython39libsite-packagesurllib3utilssl_.py", line 453, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
File "C:UsersPC-HynekAppDataLocalProgramsPythonPython39libsite-packagesurllib3utilssl_.py", line 495, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File "C:UsersPC-HynekAppDataLocalProgramsPythonPython39libssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "C:UsersPC-HynekAppDataLocalProgramsPythonPython39libssl.py", line 1040, in _create
self.do_handshake()
File "C:UsersPC-HynekAppDataLocalProgramsPythonPython39libssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1129)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersPC-HynekAppDataLocalProgramsPythonPython39libsite-packagesrequestsadapters.py", line 439, in send
resp = conn.urlopen(
File "C:UsersPC-HynekAppDataLocalProgramsPythonPython39libsite-packagesurllib3connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "C:UsersPC-HynekAppDataLocalProgramsPythonPython39libsite-packagesurllib3utilretry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.fedex.com', port=443): Max retries exceeded with url: /en-us/home.html (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1129)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:UsersPC-HynekDesktopakamaisnsr.py", line 220, in <module>
r = requests.get("https://www.fedex.com/en-us/home.html")
File "C:UsersPC-HynekAppDataLocalProgramsPythonPython39libsite-packagesrequestsapi.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "C:UsersPC-HynekAppDataLocalProgramsPythonPython39libsite-packagesrequestsapi.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "C:UsersPC-HynekAppDataLocalProgramsPythonPython39libsite-packagesrequestssessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "C:UsersPC-HynekAppDataLocalProgramsPythonPython39libsite-packagesrequestssessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "C:UsersPC-HynekAppDataLocalProgramsPythonPython39libsite-packagesrequestsadapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='www.fedex.com', port=443): Max retries exceeded with url: /en-us/home.html (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1129)')))```
pip3 install-urllib3==1.23解决了这个
如果您不关心SSL验证,请使用:
r = requests.get("https://www.fedex.com/en-us/home.html", verify=False)