Created
September 2, 2019 12:08
-
-
Save heyJordanParker/420de08378b687cef90c582a2bc1b262 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| class Server(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
| def do_GET(self): | |
| self.send_response(307) | |
| new_path = self.update_path(self.path) | |
| self.send_header('Location', new_path) | |
| self.end_headers() | |
| def update_path(self, path): | |
| return '%s%s'%('http://google.com', path) | |
| PORT = 8000 | |
| handler = SocketServer.TCPServer(("", PORT), Server) | |
| print("serving at port 8000") | |
| handler.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment