我已尽力尝试将一些示例数据从Python脚本放到Firebase上。我收到了谷歌无法帮助我的错误所以我被困住了。这是我的代码,我sudo管道所有相关的导入,并在必要的python-firebase导入的同时安装了请求2.5.1。
from firebase import firebase
fb = firebase.FirebaseApplication('https://my-firebase-url.firebaseio.com', None)
result = fb.post('/test',{'temp':'data'})
这将返回以下错误。
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/firebase/decorators.py", line 19, in wrapped
return f(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/firebase/firebase.py", line 329, in post
connection=connection)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/firebase/decorators.py", line 19, in wrapped
return f(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/firebase/firebase.py", line 97, in make_post_request
timeout=timeout)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 504, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 461, in request
resp = self.send(prep, **send_kwargs)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/Library/Python/2.7/site-packages/requests/adapters.py", line 431, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 1] _ssl.c:499: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm
答案 0 :(得分:2)
这是由于SSL过期造成的。为了解决这个问题,我将过时的Python(版本2.7)更新为2.7.9版。
要在命令行中检查SSL运行的版本,请执行以下操作: python -c“import ssl; print ssl.OPENSSL_VERSION”
这将告诉您在Python发行版中使用的SSL版本,升级之前是2006年9月28日的OpenSSL 0.9.7l,升级后是OpenSSL 0.9.8za 2014年6月5日。