Skip to content

Instantly share code, notes, and snippets.

@aishwarydhare
Created December 10, 2021 09:28
Show Gist options
  • Save aishwarydhare/3f8b31c5e97eef31fb5476537a43ea19 to your computer and use it in GitHub Desktop.
Save aishwarydhare/3f8b31c5e97eef31fb5476537a43ea19 to your computer and use it in GitHub Desktop.

Revisions

  1. aishwarydhare created this gist Dec 10, 2021.
    16 changes: 16 additions & 0 deletions python-simple-http-server.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    from http.server import BaseHTTPRequestHandler, HTTPServer


    class SampleHTTPServerHandler(BaseHTTPRequestHandler):
    def do_GET(self):
    self.send_response(200)
    self.send_header('Content-type', 'text/html')
    self.end_headers()

    print(self.headers)
    received_guid = self.headers['Access-Control-Expose-Headers']
    self.wfile.write(bytes(f"r: {received_guid}", "utf8"))


    with HTTPServer(('0.0.0.0', 8095), SampleHTTPServerHandler) as server:
    server.serve_forever()