Skip to content

Instantly share code, notes, and snippets.

@im-n1
Created October 25, 2019 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save im-n1/0161188971140316929d11669c4b26d7 to your computer and use it in GitHub Desktop.
Save im-n1/0161188971140316929d11669c4b26d7 to your computer and use it in GitHub Desktop.
Simple HTTP server
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