Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A small extension of the default Python SimpleHTTPServer that ignores the first part of the URL
import BaseHTTPServer
import SimpleHTTPServer
class MyRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def translate_path(self, path):
index = path.find('/', 2)
return SimpleHTTPServer.SimpleHTTPRequestHandler.translate_path(self, path[index:])
httpd = BaseHTTPServer.HTTPServer(server_address, MyRequestHandler)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment