File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\googleapiclient\http.py", line 164, in _retry_request
resp, content = http.request(uri, method, *args, **kwargs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\oauth2client\transport.py", line 175, in new_request
redirections, connection_type)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\oauth2client\transport.py", line 282, in request
connection_type=connection_type)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\httplib2\__init__.py", line 1926, in request
cachekey,
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\httplib2\__init__.py", line 1595, in _request
conn, request_uri, method, body, headers
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\httplib2\__init__.py", line 1501, in _conn_request
conn.connect()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\httplib2\__init__.py", line 1291, in connect
self.sock = self._context.wrap_socket(sock, server_hostname=self.host)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\ssl.py", line 407, in wrap_socket
_context=self, _session=session)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\ssl.py", line 814, in __init__
self.do_handshake()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\ssl.py", line 1068, in do_handshake
self._sslobj.do_handshake()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)
在 mac 下运行没问题,在 Linux 服务器上也 ok
在 win 跑就上面错误,是缺了什么包?
1
JasonEWNL 2019-07-26 09:05:39 +08:00 via iPad
根据报错只能推测,有没有开抓包软件导致证书错误?(关键还是把自己程序部分的报错信息发出来,目前能看到的都是回溯到库的报错。)
|
3
siebenundvierzig 2019-07-26 11:44:51 +08:00
试试在 requests.get()里添加关键字参数 verify=False
|
4
justfly 2019-07-26 11:49:59 +08:00
估计 win 上的环境有某种‘中间人’。
PS. 别听楼上的。 |
5
caoyufei OP @siebenundvierzig 用的不是 requests
是 httplib2 |
6
siebenundvierzig 2019-07-26 16:02:34 +08:00
@caoyufei 不好意思,看错了。你试试手动添加证书信息行不,在你调用 http.request 之前先 http.add_certificate
主要还是自己看文档吧 https://httplib2.readthedocs.io/en/latest/libhttplib2.html#http-objects |
7
aaronhua 2019-07-27 18:13:54 +08:00
有一个高危操作,可以试试。
import ssl # 表示忽略未经核实的 ssl 证书认证 ssl._create_default_https_context = ssl._create_unverified_context |
8
liamzz 2019-07-29 11:04:05 +08:00
遇到相同的问题,不过没报错就挂了
|
10
joson1205 2019-07-30 17:41:45 +08:00
之前遇到过类似的问题,换了 py 版本莫名其妙的好了就没管他了
|