Skip to content

Instantly share code, notes, and snippets.

@froop
Created April 6, 2021 23:19
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 froop/1cc673b8cbad9e5fd132d5b59696e8a5 to your computer and use it in GitHub Desktop.
Save froop/1cc673b8cbad9e5fd132d5b59696e8a5 to your computer and use it in GitHub Desktop.
[python] Slow HTTP server
#!/usr/bin/env python
# -*- coding: utf-8 -*-
SLEEP=5.0
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
import time
class Handle(SimpleHTTPRequestHandler, object):
def do_GET(self):
time.sleep(SLEEP)
super(Handle, self).do_GET()
HTTPServer(('', 80), Handle).serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment