Created
October 22, 2022 21:32
-
-
Save carlos-a-g-h/604075b1db1f6d53d1bedf2d29e0889a to your computer and use it in GitHub Desktop.
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
#!/usr/bin/python3.9 | |
# Extremely simple webserver made with the stdlib just for testing purposes | |
import time | |
import sys | |
from http.server import BaseHTTPRequestHandler, HTTPServer | |
try: | |
port=int(sys.argv[1]) | |
except: | |
port=80 | |
class MyServer(BaseHTTPRequestHandler): | |
def do_GET(self): | |
self.send_response(200) | |
self.send_header("Content-type","text/plain") | |
self.end_headers() | |
self.wfile.write(bytes("It's working...","utf-8")) | |
webServer = HTTPServer(("localhost",port),MyServer) | |
webServer.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment