Browse Source

init commit'

master
Paul Walko 6 years ago
commit
4fedda7974
  1. BIN
      __pycache__/serve.cpython-36.pyc
  2. 20
      serve.py

BIN
__pycache__/serve.cpython-36.pyc

Binary file not shown.

20
serve.py

@ -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()
Loading…
Cancel
Save