salmanwahed
salmanwahed

Reputation: 9647

Need explanation on flask.request

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?

Upvotes: 6

Views: 1931

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1122372

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 ...]

Upvotes: 1

Related Questions