0

requests.exceptions.SSLError在尝试使用 python 请求模块的 pushbullet API 时面临。

>>> headers
{'Access-Token': '<my-access-token>'}
>>> url
'https://api.pushbullet.com/v2/users/me'
>>> r = requests.get(url, headers=headers, verify=False)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/requests/api.py", line 55, in get
    return request('get', url, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 455, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 558, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 385, in send
    raise SSLError(e)
requests.exceptions.SSLError: [Errno 1] _ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
>>> 

然而,相同的请求适用于 curl:

curl --header 'Access-Token: <my-access-token>' https://api.pushbullet.com/v2/users/me

{"active":true,"iden":"asdasd","created":1577709095.693812,"modified":1577709152.252717,"email":"xxxxx@gmail.com","email_normalized":"xxxxx@gmail.com","name":"Mohit Chandak","image_url":"xxxxx","max_upload_size":26214400}%

我的请求模块似乎没有任何问题

>>> r = requests.get("https://google.com", verify=False)
>>> r
<Response [200]>
>>> 
4

0 回答 0