Created
April 10, 2024 19:01
-
-
Save nloadholtes/f1189a30b82d58a0ea5feadc78c06e63 to your computer and use it in GitHub Desktop.
When you just want to return 200 no matter what
This file contains hidden or 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
import http.server | |
import socketserver | |
import json | |
PORT = 8000 | |
class RequestHandler(http.server.SimpleHTTPRequestHandler): | |
def do_GET(self): | |
self.send_response(200) | |
self.send_header('Content-type', 'application/json') | |
self.end_headers() | |
self.wfile.write(json.dumps({'status': 'ok'}).encode()) | |
with socketserver.TCPServer(("", PORT), RequestHandler) as httpd: | |
httpd.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment