How do I forward a request to a different url in python

Posted by tax on Stack Overflow See other posts from Stack Overflow or by tax
Published on 2010-03-24T10:40:01Z Indexed on 2010/03/24 10:43 UTC
Read the original article Hit count: 268

Filed under:
|

import SimpleHTTPServer import SocketServer

class myHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): def do_GET(self): print self.path if self.path == '/analog': return "http://someserver.com/analog" return SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)

theport = 1234 Handler = myHandler pywebserver = SocketServer.TCPServer(("", theport), Handler)

print "Python based web server. Serving at port", theport pywebserver.serve_forever()

© Stack Overflow or respective owner

Related posts about python

Related posts about url