Skip to content Skip to sidebar Skip to footer

How To Read Parameters From GET Request In CherryPy?

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);

Solution 1:

@cherrypy.expose
def index(self, param)

where param is your GET param


Solution 2:

As virhilo mentioned, you can take named parameters in with your method.

Also, you can read cherrypy.request.params.


Solution 3:

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.


Post a Comment for "How To Read Parameters From GET Request In CherryPy?"