Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get POST variables in Python, when using gevent?

This is the question:How to get POST variables in Python, when using gevent?

The following is passed to the application:

def application(env, start_response):

And this is the other part:

if __name__ == '__main__':
print 'Serving on 8080...'
WSGIServer(('', 8080), application).serve_forever()

But env doesn't contain my POST!

Please enlighten me - where does my misunderstanding lie?

Thank you!

like image 407
tonysepia Avatar asked Dec 30 '12 18:12

tonysepia


1 Answers

You need to parse the request body environ['wsgi.input'].read().

However, you're better off using a web framework to do that for you. Most of the WSGI-enabled web frameworks work well with gevent. If you need something minimal, bottle is nice.

like image 172
Denis Avatar answered Nov 15 '22 06:11

Denis