Created
October 25, 2019 07:36
-
-
Save im-n1/0161188971140316929d11669c4b26d7 to your computer and use it in GitHub Desktop.
Simple HTTP 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
class DummyWebServer(BaseHTTPRequestHandler): | |
def do_GET(self): | |
self.send_response(200) | |
self.send_header("Content-Type", "application/json") | |
self.end_headers() | |
# Parse query string. | |
params = parse_qs(urlparse(self.path).query) | |
# Send data in JSON back. | |
self.wfile.write(bytes(json.dumps(params), "utf-8")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment