(self)
| 5 | class InteractionHandler(BaseHTTPRequestHandler): |
| 6 | |
| 7 | def do_GET(self): |
| 8 | if self.path == '/expressions': |
| 9 | expressions = self.server.interaction_server.get_expressions() |
| 10 | response = json.dumps(expressions).encode('utf-8') |
| 11 | |
| 12 | self.send_response(200) |
| 13 | self.send_header("Content-Type", "application/json") |
| 14 | self.send_header("Content-Length", str(len(response))) |
| 15 | self.end_headers() |
| 16 | self.wfile.write(response) |
| 17 | elif self.path == '/motions': |
| 18 | motions = self.server.interaction_server.get_motions() |
| 19 | response = json.dumps(motions).encode('utf-8') |
| 20 | |
| 21 | self.send_response(200) |
| 22 | self.send_header("Content-Type", "application/json") |
| 23 | self.send_header("Content-Length", str(len(response))) |
| 24 | self.end_headers() |
| 25 | self.wfile.write(response) |
| 26 | else: |
| 27 | self.send_response(404) |
| 28 | self.end_headers() |
| 29 | |
| 30 | def do_POST(self): |
| 31 | # Read the request body. |
nothing calls this directly
no test coverage detected