Skip to content

Instantly share code, notes, and snippets.

@derwolfe
Created January 10, 2017 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derwolfe/56af7e1405cb811fd36e560cfd635c94 to your computer and use it in GitHub Desktop.
Save derwolfe/56af7e1405cb811fd36e560cfd635c94 to your computer and use it in GitHub Desktop.
example of twisted web
from twisted.internet import reactor
from twisted.web.server import Site
from twisted.web.resource import Resource
class Page(Resource):
def render_GET(self, request):
return "hi".encode('utf-8')
if __name__ == '__main__':
root = Resource()
root.putChild(b"", Page())
factory = Site(root)
reactor.listenTCP(8888, factory) # @UndefinedVariable
reactor.run() # @UndefinedVariable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment