SSL 错误发生在一台计算机上而不是另一台计算机上? [英] SSL Error occurs on one computer but not the other?

查看:63
本文介绍了SSL 错误发生在一台计算机上而不是另一台计算机上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不明白为什么使用 Asana 的 API 的以下代码会突然生成以下 SSL 错误.我的笔记本电脑上一定发生了一些变化,因为它在我的另一台计算机上运行良好.

from asana import asana类登录(对象):def __init__(self):api = 'API'self.asana_api = asana.AsanaAPI(api, debug=False)self.user_id = 7359085011308L类测试(登录):定义测试(自我):编号 = 2467584555313L打印 self.asana_api.list_tasks(Id,self.user_id)回溯(最近一次调用最后一次): 中的文件/Users/Chris/Dropbox/AsanaPullPush.py",第 75 行如果 __name__ == "__main__": main()文件/Users/Chris/Dropbox/AsanaPullPush.py",第 72 行,在主目录中打印测试().测试()文件/Users/Chris/Dropbox/AsanaPullPush.py",第 15 行,在测试中打印 self.asana_api.list_tasks(Id,self.user_id)文件/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/asana/asana.py",第 174 行,在 list_tasks 中返回 self._asana(target)文件/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/asana/asana.py",第 74 行,在 _asanar = requests.get(target, auth=(self.apikey, ""))文件/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/api.py",第 55 行,在 get返回请求('get', url, **kwargs)文件/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/api.py",第 44 行,请求返回 session.request(method=method, url=url, **kwargs)文件/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py",第383行,请求resp = self.send(prep, **send_kwargs)文件/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py",第486行,发送r = adapter.send(request, **kwargs)文件/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/adapters.py",第389行,发送引发 SSLError(e)requests.exceptions.SSLError: [Errno 1] _ssl.c:507: error:0D0890A1:asn1 编码例程:ASN1_verify: 未知消息摘要算法

解决方案

我们最近更改了 SSL 密钥以应对您可能听说过的 Heartbleed 错误.http://blog.asana.com/2014/04/heartbleed/>

您的笔记本电脑似乎没有正确的 SSL.参见 https://github.com/pypa/pip/issues/829 讨论类似的问题.

您应该能够使用 python -c "import ssl; print ssl.OPENSSL_VERSION" 检查两台机器上的 SSL 版本.如果笔记本电脑确实落后,则需要更新 python 的 SSL.

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

解决方案

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.

这篇关于SSL 错误发生在一台计算机上而不是另一台计算机上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆