Skip to content

Instantly share code, notes, and snippets.

@bhornseth
Created May 2, 2014 16:56
Show Gist options
  • Save bhornseth/331a9308673f26b777a7 to your computer and use it in GitHub Desktop.
Save bhornseth/331a9308673f26b777a7 to your computer and use it in GitHub Desktop.
Simple tornado server
#!/usr/bin/env python
import tornado.ioloop
import tornado.web
import pprint
import urllib
class MyDumpHandler(tornado.web.RequestHandler):
def post(self):
unquoted = urllib.unquote(self.request.body)
split = unquoted.split('&')
joined = "\n".join(split)
print("\n\nRequest: ---------------")
print(joined)
if __name__ == "__main__":
tornado.web.Application([(r"/.*", MyDumpHandler),]).listen(8000)
tornado.ioloop.IOLoop.instance().start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment