How to read parameters from GET request in CherryPy?

Jana picture Jana · Jun 2, 2011 · Viewed 16.1k times · Source

How to read parameters from GET request in CherryPy ? I generate request from JQuery like

$.get(
    "http://localhost:8080/temp",
    "{a:10}",
    function(data) { alert(data); },
    "html"
);

and I have class temp with @cherrypy.expose function index(self). How to extract data from GET request ?

Answer

virhilo picture virhilo · Jun 2, 2011
@cherrypy.expose
def index(self, a)

where a is your GET param