Skip to content

Instantly share code, notes, and snippets.

@nloadholtes
Created April 10, 2024 19:01
Show Gist options
  • Save nloadholtes/f1189a30b82d58a0ea5feadc78c06e63 to your computer and use it in GitHub Desktop.
Save nloadholtes/f1189a30b82d58a0ea5feadc78c06e63 to your computer and use it in GitHub Desktop.
When you just want to return 200 no matter what
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