Represents the non-IO parts of a HTTP request, including the method, URL info, and headers. This class is not meant for general use. It should only be used when implementing WSGI, ASGI, or another HTTP application spec. Werkzeug provides a WSGI implementation at :cls:`werkzeug.wrappers.Request`. :param method: The method the request was made with, such as ``GET``. :param scheme: The URL scheme of the protocol the request used, such as ``https`` or ``wss``. :param server: The address of the server. ``(host, port)``, ``(path, None)`` for unix sockets, or ``None`` if not known. :param root_path: The prefix that the application is mounted under. This is prepended to generated URLs, but is not part of route matching. :param path: The path part of the URL after ``root_path``. :param query_string: The part of the URL after the "?". :param headers: The headers received with the request. :param remote_addr: The address of the client sending the request. .. versionadded:: 2.0
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Class Variable | access |
Undocumented |
Class Variable | access |
Undocumented |
Class Variable | charset |
Undocumented |
Class Variable | content |
Undocumented |
Class Variable | content |
Undocumented |
Class Variable | content |
Undocumented |
Class Variable | date |
Undocumented |
Class Variable | encoding |
The class used and returned by the :attr:`user_agent` property to parse the header. Defaults to :class:`~werkzeug.user_agent.UserAgent`, which does no parsing. An extension can provide a subclass that uses a parser to provide other data. |
Class Variable | max |
Undocumented |
Class Variable | origin |
Undocumented |
Class Variable | referrer |
Undocumented |
Class Variable | trusted |
Undocumented |
Instance Variable | headers |
Undocumented |
Instance Variable | method |
Undocumented |
Instance Variable | path |
Undocumented |
Instance Variable | query |
Undocumented |
Instance Variable | remote |
Undocumented |
Instance Variable | root |
Undocumented |
Instance Variable | scheme |
Undocumented |
Instance Variable | server |
Undocumented |
Property | accept |
List of charsets this client supports as :class:`~werkzeug.datastructures.CharsetAccept` object. |
Property | accept |
List of encodings this client accepts. Encodings in a HTTP term are compression encodings such as gzip. For charsets have a look at :attr:`accept_charset`. |
Property | accept |
List of languages this client accepts as :class:`~werkzeug.datastructures.LanguageAccept` object. |
Property | accept |
List of mimetypes this client supports as :class:`~werkzeug.datastructures.MIMEAccept` object. |
Property | access |
If a forwarded header exists this is a list of all ip addresses from the client ip to the last proxy server. |
Property | args |
The parsed URL parameters (the part in the URL after the question mark). |
Property | authorization |
The `Authorization` object in parsed form. |
Property | base |
Like :attr:`url` but without the query string. |
Property | cache |
A :class:`~werkzeug.datastructures.RequestCacheControl` object for the incoming cache control headers. |
Property | content |
The Content-Length entity-header field indicates the size of the entity-body in bytes or, in the case of the HEAD method, the size of the entity-body that would have been sent had the request been a GET. |
Property | cookies |
A :class:`dict` with the contents of all cookies transmitted with the request. |
Property | full |
Requested path, including the query string. |
Property | host |
The host name the request was made to, including the port if it's non-standard. Validated with :attr:`trusted_hosts`. |
Property | host |
The request URL scheme and host only. |
Property | if |
An object containing all the etags in the `If-Match` header. |
Property | if |
The parsed `If-Modified-Since` header as a datetime object. |
Property | if |
An object containing all the etags in the `If-None-Match` header. |
Property | if |
The parsed ``If-Range`` header. |
Property | if |
The parsed `If-Unmodified-Since` header as a datetime object. |
Property | is |
Check if the mimetype indicates JSON data, either :mimetype:`application/json` or :mimetype:`application/*+json`. |
Property | is |
``True`` if the request was made with a secure protocol (HTTPS or WSS). |
Property | mimetype |
Like :attr:`content_type`, but without parameters (eg, without charset, type etc.) and always lowercase. For example if the content type is ``text/HTML; charset=utf-8`` the mimetype would be ``'text/html'``. |
Property | mimetype |
The mimetype parameters as dict. For example if the content type is ``text/html; charset=utf-8`` the params would be ``{'charset': 'utf-8'}``. |
Property | pragma |
The Pragma general-header field is used to include implementation-specific directives that might apply to any recipient along the request/response chain. All pragma directives specify optional behavior from the viewpoint of the protocol; however, some systems MAY require that behavior be consistent with the directives. |
Property | range |
The parsed `Range` header. |
Property | root |
The request URL scheme, host, and root path. This is the root that the application is accessed from. |
Property | url |
The full request URL with the scheme, host, root path, path, and query string. |
Property | url |
The charset that is assumed for URLs. Defaults to the value of :attr:`charset`. |
Property | user |
The user agent. Use ``user_agent.string`` to get the header value. Set :attr:`user_agent_class` to a subclass of :class:`~werkzeug.user_agent.UserAgent` to provide parsing for the other properties or other extended data. |
Method | _parse |
Undocumented |
Instance Variable | _parsed |
Undocumented |
str
, scheme: str
, server: t.Optional[ t.Tuple[ str, t.Optional[ int]]]
, root_path: str
, path: str
, query_string: bytes
, headers: Headers
, remote_addr: t.Optional[ str]
):
(source)
¶
werkzeug.wrappers.request.Request
Undocumented
The class used and returned by the :attr:`user_agent` property to parse the header. Defaults to :class:`~werkzeug.user_agent.UserAgent`, which does no parsing. An extension can provide a subclass that uses a parser to provide other data. .. versionadded:: 2.0
List of encodings this client accepts. Encodings in a HTTP term are compression encodings such as gzip. For charsets have a look at :attr:`accept_charset`.
List of languages this client accepts as :class:`~werkzeug.datastructures.LanguageAccept` object. .. versionchanged 0.5 In previous versions this was a regular :class:`~werkzeug.datastructures.Accept` object.
If a forwarded header exists this is a list of all ip addresses from the client ip to the last proxy server.
The parsed URL parameters (the part in the URL after the question mark). By default an :class:`~werkzeug.datastructures.ImmutableMultiDict` is returned from this function. This can be changed by setting :attr:`parameter_storage_class` to a different type. This might be necessary if the order of the form data is important.
A :class:`~werkzeug.datastructures.RequestCacheControl` object for the incoming cache control headers.
The Content-Length entity-header field indicates the size of the entity-body in bytes or, in the case of the HEAD method, the size of the entity-body that would have been sent had the request been a GET.
The host name the request was made to, including the port if it's non-standard. Validated with :attr:`trusted_hosts`.
An object containing all the etags in the `If-Match` header. :rtype: :class:`~werkzeug.datastructures.ETags`
The parsed `If-Modified-Since` header as a datetime object. .. versionchanged:: 2.0 The datetime object is timezone-aware.
An object containing all the etags in the `If-None-Match` header. :rtype: :class:`~werkzeug.datastructures.ETags`
The parsed ``If-Range`` header. .. versionchanged:: 2.0 ``IfRange.date`` is timezone-aware. .. versionadded:: 0.7
The parsed `If-Unmodified-Since` header as a datetime object. .. versionchanged:: 2.0 The datetime object is timezone-aware.
Check if the mimetype indicates JSON data, either :mimetype:`application/json` or :mimetype:`application/*+json`.
Like :attr:`content_type`, but without parameters (eg, without charset, type etc.) and always lowercase. For example if the content type is ``text/HTML; charset=utf-8`` the mimetype would be ``'text/html'``.
The mimetype parameters as dict. For example if the content type is ``text/html; charset=utf-8`` the params would be ``{'charset': 'utf-8'}``.
The Pragma general-header field is used to include implementation-specific directives that might apply to any recipient along the request/response chain. All pragma directives specify optional behavior from the viewpoint of the protocol; however, some systems MAY require that behavior be consistent with the directives.
The request URL scheme, host, and root path. This is the root that the application is accessed from.
The charset that is assumed for URLs. Defaults to the value of :attr:`charset`. .. versionadded:: 0.6
The user agent. Use ``user_agent.string`` to get the header value. Set :attr:`user_agent_class` to a subclass of :class:`~werkzeug.user_agent.UserAgent` to provide parsing for the other properties or other extended data. .. versionchanged:: 2.0 The built in parser is deprecated and will be removed in Werkzeug 2.1. A ``UserAgent`` subclass must be set to parse data from the string.