Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need explanation on flask.request

Tags:

python

flask

I am using the flask micro-framework and need some explanation on the flask.request. The documentation on the The request context is not clear to me. As I tried:

from flask import request
help(request)

which returns Help on LocalProxy in module werkzeug.local object and dir(request) returns an empty list.What methods I can access using a dot on request?

like image 718
salmanwahed Avatar asked Mar 26 '14 08:03

salmanwahed


1 Answers

The Flask request global is a proxy object for a request context; the proxy accesses the correct context to keep your request data access thread safe.

See the Request Context documentation.

For documentation on what is available, you can read the flask.Request API documentation, and the Werkzeug documentation on Request / Response objects.

In an interactive session, import flask.wrappers.Request:

>>> from flask.wrappers import Request
>>> Request
<class 'flask.wrappers.Request'>
>>> help(Request)
Help on class Request in module flask.wrappers:
[ ... etc ...]
like image 96
Martijn Pieters Avatar answered Sep 24 '22 19:09

Martijn Pieters