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 ?
@cherrypy.expose
def index(self, param)
where param
is your GET param
As virhilo mentioned, you can take named parameters in with your method.
Also, you can read cherrypy.request.params
.
With both POST and GET (and PUT, PATCH, etc...) you can use:
cherrypy.request.params.get(key_name)
Where key_name
is the key name you want to get.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With