小编ker*_*ter的帖子

用Pypy跑来跑去

我正在尝试Pypy因为它在CPython上显示出令人印象深刻的基准.另外,我主要在代码中使用Twisted库.我现在可以运行一个使用Twisted reactor的基准脚本,所以我猜我的设置很好.但是,我不知道如何使用Pypy运行Twisted daemonizer(twistd).

pypy twisted twistd

6
推荐指数
1
解决办法
2463
查看次数

如何在Facebook图形api上使用twisted.web.client.Agent时处理OpenSSL.SSL.Error?

我正在运行ff.来自Mac OS X(优胜美地)上的virtualenv的代码:

    # testfb.py
    from twisted.internet import reactor
    from twisted.python import log
    from twisted.web.client import Agent

    GRAPH_API = "https://graph.facebook.com/v2.5"

    def stop(_):
        reactor.stop()

    def get_me(access_token):
        agent = Agent(reactor)
        uri = "{}/me?access_token={}".format(GRAPH_API, access_token)
        log.msg("uri:" + uri)
        return agent.request("GET", uri)

    if __name__ == "__main__":
        import sys
        access_token = sys.argv[1]
        d = get_me(access_token)
        d.addErrback(log.err)
        d.addCallback(stop)
        reactor.run()
Run Code Online (Sandbox Code Playgroud)

我得到:

    Failure: twisted.web._newclient.ResponseNeverReceived: [<twisted.python.failure.Failure OpenSSL.SSL.Error: [('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')]>]
Run Code Online (Sandbox Code Playgroud)

当我用卷毛打电话给uri时,我没有这个问题.

顺便说一下,我还在virtualenv上使用pip安装了service_identity.

python ssl twisted

4
推荐指数
1
解决办法
2668
查看次数

标签 统计

twisted ×2

pypy ×1

python ×1

ssl ×1

twistd ×1