Twisted is a Python library. To use it, you can import it, for example, here is a web server from a twisted home page :
#!/usr/bin/env python from twisted.web import server, resource from twisted.internet import reactor, endpoints class Counter(resource.Resource): isLeaf = True numberRequests = 0 def render_GET(self, request): self.numberRequests += 1 request.setHeader("content-type", "text/plain") return "I am request #" + str(self.numberRequests) + "\n" endpoints.serverFromString(reactor, "tcp:8080").listen(server.Site(Counter())) reactor.run()
Save it to a file, for example, counter_server.py and run: py counter_server.py . You can visit http://localhost:8080/ to make sure it works (this is not with version twisted-15.2.1 in Python 3). Twisted is only partially ported to Python 3 (graph based on data from a year ago).
twistd is a Python program that uses the twisted Python package (note: e ). It has not yet migrated to Python 3 ( pip install twisted installs it on Python 2, but it does not install it on Python 3).
jfs Jul 14 '15 at 20:35 2015-07-14 20:35
source share