-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.py
More file actions
28 lines (19 loc) · 674 Bytes
/
Copy pathserver.py
File metadata and controls
28 lines (19 loc) · 674 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Author: Ellis Madagan
# Last update: 2/25/2018
from http.server import BaseHTTPRequestHandler
import socketserver
import facecut
class HTTPRequestHandler(BaseHTTPRequestHandler):
def do_POST(self):
content_length = int(self.headers['Content-Length'])
post_data = self.rfile.read(content_length)
self.send_response(200)
self.send_header('Content-Type', 'text/html')
self.end_headers()
payload = post_data.decode('utf-8').split()[-2]
facecut.process_image(payload)
def run():
# Set up and start server
httpd = socketserver.TCPServer(('', 1337), HTTPRequestHandler)
httpd.serve_forever()
run()