Last active
December 9, 2020 16:38
-
-
Save marduc812/a8e24b9b8ff79250d2f9d0835fca7f12 to your computer and use it in GitHub Desktop.
Snippet for sending every status code needed using Python'
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
from http.server import HTTPServer, BaseHTTPRequestHandler | |
ADDRESS = "" | |
PORT = 8000 | |
class RequestHandler(BaseHTTPRequestHandler): | |
def do_GET(self): | |
# Select the HTTP Response needed, currently it's 204 | |
self.send_response(204) | |
def run(server_class=HTTPServer, handler_class=BaseHTTPRequestHandler): | |
server_address = (ADDRESS, PORT) | |
httpd = server_class(server_address, handler_class) | |
httpd.serve_forever() | |
if __name__ == '__main__': | |
run(handler_class=RequestHandler) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment