Skip to content

Instantly share code, notes, and snippets.

@vegitron
Created January 5, 2017 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vegitron/bc04b8ed6c73a72a4095bf2c3e50c3fc to your computer and use it in GitHub Desktop.
Save vegitron/bc04b8ed6c73a72a4095bf2c3e50c3fc to your computer and use it in GitHub Desktop.
A server that bypasses httplib's timeout
import BaseHTTPServer
import SocketServer
import time
class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(s):
s.send_response(200)
s.send_header("Content-type", "text/html")
s.end_headers()
for i in range(100):
s.wfile.write("OK")
time.sleep(1)
httpd = SocketServer.TCPServer(("", 8003), Handler)
httpd.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment