cherrypy - Server in Python: write or add parameters on URL possible without redirect -
I need a command to work with URLs using CherryPy and Python version 2.7.3
I want to change the URL.
Old URL
localhost: 8080 and auto foo = 1 & amp; Foo = url localhost: 8080? = Foo = 1 & amp; 2 = ( variable s ) in cherrypy import urllib class root (commodity) in foo = 2 import: @charyipi. Expose DEF Index (self): JSONDICT = [('FU', '1'), ('FU', '2')] s = urllib.urlencode (jsondict) print s # foo = 1 & amp; Foo = 2 return "hello" Cherrypy.config.update ({'global': {'server.socketPort': 8080}} cherrypy.quickstart (root ()) a solution ?
Tips with Andrew with raise cherry.HTTPRedirect ("localhost: 8080?" + Params) It is working but this is for redirection.
I am not interested in it, but using the redirect, I write on the new URL.
I do not want to redirect, but I always work on this URL,
What about a simple redirect?
Import cherrypy class root (object): @ cherry. Expose DEF Index (self): urlVar = 1 urlVar2 = 2 cherries. Increased HTTPRAD ("LocalHost: 8080? Af =" + str (urlVar) + "& amp; fooo =" + str (urlVar2)) cherrypy.config.update ({'global': {'server.socketPort': 8080} }) Cherrypy.quickstart (root ())
Comments
Post a Comment