Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Simple echo script that does cool things.
#!/usr/bin/env python
# Echoes the URL back, replacing / with spaces.
# Based off Nathan Hamiel's Reflect script (
# By Kaz Wolfe, 2017. No rights reserved.
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_header("Content-type", "text/plain")
self.wfile.write(self.path.replace("/", " ").strip())
port = 9001
print('Listening on localhost:%s' % port)
server = HTTPServer(('', port), RequestHandler)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.