SSL Error occurs on one computer but not the other?

大憨熊 提交于 2019-12-20 04:38:26

问题


I can't figure out why all of a sudden the below code that uses Asana's API generates the below SSL error. Something must have changed on my laptop, since it runs perfectly on my other computer.

from asana import asana

class Login(object):
    def __init__(self):
        api = 'API'
        self.asana_api = asana.AsanaAPI(api, debug=False)
        self.user_id = 7359085011308L

class Test(Login):
    def Test(self):
        Id = 2467584555313L
        print self.asana_api.list_tasks(Id,self.user_id)


Traceback (most recent call last):
  File "/Users/Chris/Dropbox/AsanaPullPush.py", line 75, in <module>
    if __name__ == "__main__": main()
  File "/Users/Chris/Dropbox/AsanaPullPush.py", line 72, in main
    print Test().Test()
  File "/Users/Chris/Dropbox/AsanaPullPush.py", line 15, in Test
    print self.asana_api.list_tasks(Id,self.user_id)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/asana/asana.py", line 174, in list_tasks
    return self._asana(target)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/asana/asana.py", line 74, in _asana
    r = requests.get(target, auth=(self.apikey, ""))
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/api.py", line 55, in get
    return request('get', url, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 383, in request
    resp = self.send(prep, **send_kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 486, in send
    r = adapter.send(request, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/adapters.py", line 389, in send
    raise SSLError(e)
requests.exceptions.SSLError: [Errno 1] _ssl.c:507: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm

回答1:


We recently changed our SSL key in response to the Heartbleed bug you may have heard about. http://blog.asana.com/2014/04/heartbleed/

It looks like your laptop may not have the right SSL. See https://github.com/pypa/pip/issues/829 for discussion of a similar issue.

You should be able to check SSL version on the two machines with python -c "import ssl; print ssl.OPENSSL_VERSION". If indeed the laptop is behind, you'll need to update your python's SSL.



来源:https://stackoverflow.com/questions/23002438/ssl-error-occurs-on-one-computer-but-not-the-other

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!