【发布时间】:2017-02-25 00:43:45
【问题描述】:
我最近发现了 Twisted python 库,并试图用一个测试脚本来设置它。
from twisted.internet.protocol import Protocol, Factory
from twisted.internet import reactor
class Pong(Protocol):
def connectionMade(self):
self.transport.write("HTTP/1.0 200 OK\r\nContent-Length: 5\r\n\r\nPong!\r\n")
self.transport.loseConnection()
# Start the reactor
factory = Factory()
factory.protocol = Pong
reactor.listenTCP(8000, factory)
reactor.run()
当我在终端中运行上述(我使用的是 python 2.7.9 btw)时,我得到一个错误。错误的最后一行如下。如果你需要其他的,我也可以发布。
AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1'
【问题讨论】:
标签: python macos twisted twisted.internet