-
-
Save darekmydlarz/d48d02de6b3a55afa571178669dde865 to your computer and use it in GitHub Desktop.
Python SimpleHTTPServer com sleep
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 SimpleHTTPServer | |
import SocketServer | |
from time import sleep | |
PORT = 5000 | |
SLEEP_TIME = 6 | |
class SlowHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
def do_GET(self): | |
sleep(SLEEP_TIME) | |
SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) | |
Handler = SlowHandler | |
httpd = SocketServer.TCPServer(("", PORT), Handler) | |
print "serving at port", PORT | |
httpd.serve_forever() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment