我试图使command-line Python starter for Google Plus API工作,但是在身份验证完成后,我遇到了此错误:ssl.SSLError: [Errno 185090050] _ssl.c:336: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib
我正在运行Python 2.7 on Ubuntu 11.04
。 API使用httplib2
发送请求。我正在使用localhost
入门套件。
这是终端转储:
Traceback (most recent call last):
File "/home/vijay/Downloads/google-plus-python-starter/cli/plus_cli.py", line 114, in <module>
main()
File "/home/vijay/Downloads/google-plus-python-starter/cli/plus_cli.py", line 62, in main
credentials = authorize_self(settings.CLIENT_ID,settings.CLIENT_SECRET)
File "/home/vijay/Downloads/google-plus-python-starter/cli/plus_cli.py", line 48, in authorize_self
credentials = run(flow, storage)
File "/home/vijay/Downloads/googleapi/oauth2client/tools.py", line 146, in run
credential = flow.step2_exchange(code)
File "/home/vijay/Downloads/googleapi/oauth2client/client.py", line 698, in step2_exchange
headers=headers)
File "/home/vijay/Downloads/googleapi/httplib2/__init__.py", line 1436, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "/home/vijay/Downloads/googleapi/httplib2/__init__.py", line 1188, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/home/vijay/Downloads/googleapi/httplib2/__init__.py", line 1123, in _conn_request
conn.connect()
File "/home/vijay/Downloads/googleapi/httplib2/__init__.py", line 890, in connect
self.disable_ssl_certificate_validation, self.ca_certs)
File "/home/vijay/Downloads/googleapi/httplib2/__init__.py", line 76, in _ssl_wrap_socket
cert_reqs=cert_reqs, ca_certs=ca_certs)
File "/usr/lib/python2.7/ssl.py", line 344, in wrap_socket
ciphers=ciphers)
File "/usr/lib/python2.7/ssl.py", line 119, in __init__
ciphers)
ssl.SSLError: [Errno 185090050] _ssl.c:336: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib`
我试图使此工作的事情:
手动将cacerts.txt从
http://httplib2.googlecode.com/hg-history/6525cadfde53279479533c1235e2661f5c147afc/python2/httplib2/cacerts.txt
复制到/usr/lib/python2.7/dist-packages/httplib2
httplib2
更新到最新版本0.7.1使用
httplib2.Http(disable_ssl_certificate_validation=True)
从入门工具包(plus_cli.py)中的文件进行的所有httplib2调用中禁用SSL我没有主意,需要您的帮助来解决。
最佳答案
如果有人有类似的错误(错误代码185090050):
使用Dropbox API时,我遇到了同样的事情。问题是无法加载包含证书信息的文件。就我而言,这是因为pyInstaller与Dropbox SKD使用的pkg_resources不兼容。只需编辑将Dropbox的rest.py
中的证书分配给以下内容的行:
TRUSTED_CERT_FILE = 'trusted-certs.crt'
而不是使用pkg_resources,然后将受信任的证书列表与应用程序一起分发。 Python SSL库显示非常不透明的错误消息,但实际上,这只是丢失的文件...
关于python - 寻求解决在本地运行的Google Plus API命令行Python入门工具包中的SSL错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7451859/