Created
September 21, 2014 01:24
-
-
Save kylemcdonald/3bb71e4b901c54073cbc to your computer and use it in GitHub Desktop.
Python POST simple server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SimpleHTTPServer | |
import SocketServer | |
PORT = 8000 | |
class ServerHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
def do_POST(self): | |
content_len = int(self.headers.getheader('content-length', 0)) | |
post_body = self.rfile.read(content_len) | |
print post_body | |
Handler = ServerHandler | |
httpd = SocketServer.TCPServer(("", PORT), Handler) | |
print "serving at port", PORT | |
httpd.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment