Represents an incoming WSGI HTTP request, with headers and body taken from the WSGI environment. Has properties and methods for using the functionality defined by various HTTP specs. The data in requests object is read-only. Text data is assumed to use UTF-8 encoding, which should b
| 29 | |
| 30 | |
| 31 | class Request(_SansIORequest): |
| 32 | """Represents an incoming WSGI HTTP request, with headers and body |
| 33 | taken from the WSGI environment. Has properties and methods for |
| 34 | using the functionality defined by various HTTP specs. The data in |
| 35 | requests object is read-only. |
| 36 | |
| 37 | Text data is assumed to use UTF-8 encoding, which should be true for |
| 38 | the vast majority of modern clients. Using an encoding set by the |
| 39 | client is unsafe in Python due to extra encodings it provides, such |
| 40 | as ``zip``. To change the assumed encoding, subclass and replace |
| 41 | :attr:`charset`. |
| 42 | |
| 43 | :param environ: The WSGI environ is generated by the WSGI server and |
| 44 | contains information about the server configuration and client |
| 45 | request. |
| 46 | :param populate_request: Add this request object to the WSGI environ |
| 47 | as ``environ['werkzeug.request']``. Can be useful when |
| 48 | debugging. |
| 49 | :param shallow: Makes reading from :attr:`stream` (and any method |
| 50 | that would read from it) raise a :exc:`RuntimeError`. Useful to |
| 51 | prevent consuming the form data in middleware, which would make |
| 52 | it unavailable to the final application. |
| 53 | |
| 54 | .. versionchanged:: 3.0 |
| 55 | The ``charset``, ``url_charset``, and ``encoding_errors`` parameters |
| 56 | were removed. |
| 57 | |
| 58 | .. versionchanged:: 2.1 |
| 59 | Old ``BaseRequest`` and mixin classes were removed. |
| 60 | |
| 61 | .. versionchanged:: 2.1 |
| 62 | Remove the ``disable_data_descriptor`` attribute. |
| 63 | |
| 64 | .. versionchanged:: 2.0 |
| 65 | Combine ``BaseRequest`` and mixins into a single ``Request`` |
| 66 | class. |
| 67 | |
| 68 | .. versionchanged:: 0.5 |
| 69 | Read-only mode is enforced with immutable classes for all data. |
| 70 | """ |
| 71 | |
| 72 | #: the maximum content length. This is forwarded to the form data |
| 73 | #: parsing function (:func:`parse_form_data`). When set and the |
| 74 | #: :attr:`form` or :attr:`files` attribute is accessed and the |
| 75 | #: parsing fails because more than the specified value is transmitted |
| 76 | #: a :exc:`~werkzeug.exceptions.RequestEntityTooLarge` exception is raised. |
| 77 | #: |
| 78 | #: .. versionadded:: 0.5 |
| 79 | max_content_length: int | None = None |
| 80 | |
| 81 | #: the maximum form field size. This is forwarded to the form data |
| 82 | #: parsing function (:func:`parse_form_data`). When set and the |
| 83 | #: :attr:`form` or :attr:`files` attribute is accessed and the |
| 84 | #: data in memory for post data is longer than the specified value a |
| 85 | #: :exc:`~werkzeug.exceptions.RequestEntityTooLarge` exception is raised. |
| 86 | #: |
| 87 | #: .. versionchanged:: 3.1 |
| 88 | #: Defaults to 500kB instead of unlimited. |
no outgoing calls