小编Dav*_*ein的帖子

由于Windows上的空信任存储,python treq因Twisted/OpenSSL错误而失败

当我在http://www.google.com上运行以下示例代码时,它运行正常但是当我尝试https://www.google.com时,我收到此错误:

Requesting https://www.google.com

Unhandled error in Deferred:
Unhandled Error
Traceback (most recent call last):
Failure: twisted.web._newclient.ResponseNeverReceived: [<twisted.python.failure.Failure <class 'OpenSSL.SSL.Error'>>]
Run Code Online (Sandbox Code Playgroud)

我使用的是python 2.7.8,twisted 14.0.2,service_identity 14.0.0,treq 0.2.1,OpenSSL 0.14

import treq
from twisted.internet import reactor, defer
import sys

@defer.inlineCallbacks
def doit(url):
    print "Requesting "+ url + "\n"
    results = yield treq.get(url)
    print "...got results\n"
    content = yield results.content()
    print "%s"%content
    reactor.stop()

def main():
    url = sys.argv[1]
    reactor.callLater(0, doit, url)
    reactor.run()

if __name__ == '__main__':
    main()
Run Code Online (Sandbox Code Playgroud)

提前致谢!

python windows ssl twisted

3
推荐指数
1
解决办法
634
查看次数

标签 统计

python ×1

ssl ×1

twisted ×1

windows ×1