Skip to content
Myr

Fix Request Reference (#2151)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Points flask.Request to appropriate place in the documentation.

authored by Dennis Chen · committed by Markus Unterwaditzer · parent 6c9ff85 · Browse files · 1 file+5 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−5 removed

  • other:+5 added−5 removed

1 file+5 added−5 removed

modified:docs/quickstart.rst+5 added-5 removed
536 unmodified lines
537The Request Object538``````````````````539540The request object is documented in the API section and we will not cover541it here in detail (see :class:`~flask.request`). Here is a broad overview of541it here in detail (see :class:`~flask.Request`). Here is a broad overview of542some of the most common operations. First of all you have to import it from543the ``flask`` module::544545 from flask import request546547The current request method is available by using the548:attr:`~flask.request.method` attribute. To access form data (data548:attr:`~flask.Request.method` attribute. To access form data (data549transmitted in a ``POST`` or ``PUT`` request) you can use the550:attr:`~flask.request.form` attribute. Here is a full example of the two550:attr:`~flask.Request.form` attribute. Here is a full example of the two551attributes mentioned above::552553 @app.route('/login', methods=['POST', 'GET'])554 def login():
14 unmodified lines
569error page is shown instead. So for many situations you don't have to570deal with that problem.571572To access parameters submitted in the URL (``?key=value``) you can use the573:attr:`~flask.request.args` attribute::573:attr:`~flask.Request.args` attribute::574575 searchword = request.args.get('key', '')576577We recommend accessing URL parameters with `get` or by catching the578:exc:`KeyError` because users might change the URL and presenting them a 400579bad request page in that case is not user friendly.580581For a full list of methods and attributes of the request object, head over582to the :class:`~flask.request` documentation.582to the :class:`~flask.Request` documentation.583584585File Uploads586````````````
307 unmodified lines