Flask: request vs Request
Andrew Z
formisc at gmail.com
Mon Mar 12 09:27:00 EDT 2018
Thank you Christopher.
On Mar 12, 2018 09:10, "Christopher Mullins" <christopherrmullins at gmail.com>
wrote:
> Could you please give some context when you reply, TIA
>>>> Whoops, thanks for the reminder Mark.
>> So what for the Request is used for then?
>>> In general when you see that something in Python starts with a capital
> letter, that indicates a class. Check out the relevant section of the PEP8
> coding style [1], this is a good reference to have on hand. (This
> generalization doesn't apply to builtin types which follow a separate
> convention, also outlined in [1] -- and of course there are a numerous
> exceptions.)
>> This holds for your variable in question "request" which is an instance of
> the Request class. Check out [2] for more information on this. PyCharm
> tries to do its best but I've had this problem too. You can always open up
> a python REPL and look at the object yourself:
>> >>> import flask
> >>> r = flask.Request
> >>> r
> <class 'flask.wrappers.Request'>
> >>> dir(r)
>> and so on. When I'm working in python I like to keep one of these open
> for this purpose.
>> HTH,
> Chris
>> [1] https://www.python.org/dev/peps/pep-0008/#class-names
> [2] http://flask.pocoo.org/docs/0.12/api/#incoming-request-data
>>>
More information about the Python-list
mailing list