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!
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.
Here is example code of request handler:
def
callback(request):
post_data = request.input_buffer.read(-1)
链接地址: http://www.djcxy.com/p/11672.html
上一篇: C#事件系统对于单个事件是确定性的