init commit'

master
Paul Walko 2017-02-15 20:50:06 +00:00
commit 4fedda7974
2 changed files with 20 additions and 0 deletions

Binary file not shown.

20
serve.py Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/python
from http.server import HTTPServer, CGIHTTPRequestHandler
import urllib
class POSTHandler(CGIHTTPRequestHandler):
def do_POST(self):
length = int(self.headers['Content-Length'])
post_data = urllib.parse.parse_qs(self.rfile.read(length).decode('utf-8'))
print(post_data)
# You now have a dictionary of the post data
self.send_response(200)
self.end_headers()
return
if __name__ == '__main__':
server = HTTPServer(('localhost', 5001), POSTHandler)
print('Starting server...')
server.serve_forever()