Created
November 26, 2018 19:53
-
-
Save mrcnc/9d3f91737f0e5d5c6fc3c0dcc8a6000a to your computer and use it in GitHub Desktop.
a simple server that runs in python2 that always returns a 500 (useful for testing)
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
import BaseHTTPServer | |
HOST = "0.0.0.0" | |
PORT = 8000 | |
class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler): | |
def do_GET(self): | |
self.send_response(500) | |
self.send_header("Content-type", "text/plain") | |
self.end_headers() | |
self.wfile.write("Internal Server Error\n") | |
if __name__ == "__main__": | |
httpd = BaseHTTPServer.HTTPServer((HOST, PORT), MyHandler) | |
print("Test server started on {}:{}".format(HOST, PORT)) | |
httpd.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment