Last active
April 26, 2020 19:38
-
-
Save burrussmp/82351c905cf022b129c909bb9c9837ac to your computer and use it in GitHub Desktop.
A simply python server
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 | |
class Handler(http.server.BaseHTTPRequestHandler): | |
def do_GET(self): | |
if self.path == '/data': # handle any GET requests to /data | |
pass | |
elif self.path == '/annotation':# handle any GET requests to /annotation | |
pass | |
def do_POST(self): # handle general post event | |
pass | |
if __name__ == '__main__': | |
HOST_NAME = "YOURIPADDRESS" | |
PORT_NUMBER = 8080 | |
httpd = socketserver.TCPServer((HOST_NAME, PORT_NUMBER), Handler) | |
print(time.asctime(), "Server Starts - %s:%s" % (HOST_NAME, PORT_NUMBER)) | |
try: | |
httpd.serve_forever() | |
except KeyboardInterrupt: | |
pass | |
httpd.shutdown() | |
print(time.asctime(), "Server Stops - %s:%s" % (HOST_NAME, PORT_NUMBER)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment