Created
June 15, 2017 09:24
-
-
Save ykhrustalev/e63b90c592e65b6fda9f62aac34fe706 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
from __future__ import print_function | |
import SimpleHTTPServer | |
import SocketServer | |
import sys | |
class ServerHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
def do_GET(self): | |
SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) | |
def do_POST(self): | |
self.do_GET() | |
if __name__ == "__main__": | |
host = '' | |
port = 8000 | |
if len(sys.argv) == 2: | |
port = int(sys.argv[1]) | |
elif len(sys.argv) > 2: | |
host = sys.argv[1] | |
port = int(sys.argv[2]) | |
server = SocketServer.TCPServer((host, port), ServerHandler) | |
server.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment