Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Distinguishing between GET and POST data in CherryPy?

I've been deciding between Python web frameworks for a project of mine and I've really liked how lightweight, flexible, and concise CherryPy is compared to others. The only problem I'm having is I can't find any documentation on how to distinguish between data sent via GET and via POST.

For example, I don't want users to be able to provide their login credentials through a GET request (http://example.com/login?username=user&password=pass) but, according to CherryPy's tutorial, all data is sent as method parameters, no matter what HTTP method they're sent as. Is there some way to say I only want the POST data or do I have to use MethodDispatcher?

Thanks!

like image 800
Patrick Avatar asked Apr 07 '11 23:04

Patrick


1 Answers

See the docs.

A string containing the HTTP method, such as "GET" or "POST". Set in the "run" phase.

looks like checking cherrypy.request.method is what you want to do.

like image 186
photoionized Avatar answered Sep 22 '22 10:09

photoionized