class documentation

class LocalRequest(BaseRequest): (source)

View In Hierarchy

A thread-local subclass of :class:`BaseRequest` with a different set of attributes for each thread. There is usually only one global instance of this class (:data:`request`). If accessed during a request/response cycle, this instance always refers to the *current* request (even on a multithreaded server).

Class Variable environ Undocumented

Inherited from BaseRequest:

Method __delitem__ Undocumented
Method __getattr__ Search in self.environ for additional user defined attributes.
Method __getitem__ Undocumented
Method __init__ Wrap a WSGI environ dictionary.
Method __iter__ Undocumented
Method __len__ Undocumented
Method __repr__ Undocumented
Method __setattr__ Undocumented
Method __setitem__ Change an environ value and clear all caches that depend on it.
Method copy Return a new :class:`Request` with a shallow :attr:`environ` copy.
Method get Undocumented
Method get_cookie Return the content of a cookie. To read a `Signed Cookie`, the `secret` must match the one used to create the cookie (see :meth:`BaseResponse.set_cookie`). If anything goes wrong (missing cookie or wrong signature), return a default value...
Method get_header Return the value of a request header, or a given default value.
Method keys Undocumented
Method path_shift Shift path segments from :attr:`path` to :attr:`script_name` and vice versa.
Constant MEMFILE_MAX Undocumented
Class Variable __slots__ Undocumented
Property app Bottle application handling this request.
Property auth HTTP authentication data as a (user, password) tuple. This implementation currently supports basic (not digest) authentication only. If the authentication happened at a higher level (e.g. in the front web-server or a middleware), the password field is None, but the user field is looked up from the ``REMOTE_USER`` environ variable...
Property body The HTTP request body as a seek-able file-like object. Depending on :attr:`MEMFILE_MAX`, this is either a temporary file or a :class:`io.BytesIO` instance. Accessing this property for the first time reads and replaces the ``wsgi...
Property chunked True if Chunked transfer encoding was.
Property content_length The request body length as an integer. The client is responsible to set this header. Otherwise, the real length of the body is unknown and -1 is returned. In this case, :attr:`body` will be empty.
Property content_type The Content-Type header as a lowercase-string (default: empty).
Property cookies Cookies parsed into a :class:`FormsDict`. Signed cookies are NOT decoded. Use :meth:`get_cookie` if you expect signed cookies.
Property files File uploads parsed from `multipart/form-data` encoded POST or PUT request body. The values are instances of :class:`FileUpload`.
Property forms Form values parsed from an `url-encoded` or `multipart/form-data` encoded POST or PUT request body. The result is returned as a :class:`FormsDict`. All keys and values are strings. File uploads are stored separately in :attr:`files`...
Property fullpath Request path including :attr:`script_name` (if present).
Property headers A :class:`WSGIHeaderDict` that provides case-insensitive access to HTTP request headers.
Property is_ajax Alias for :attr:`is_xhr`. "Ajax" is not the right term.
Property is_xhr True if the request was triggered by a XMLHttpRequest. This only works with JavaScript libraries that support the `X-Requested-With` header (most of the popular libraries do).
Property json If the ``Content-Type`` header is ``application/json``, this property holds the parsed content of the request body. Only requests smaller than :attr:`MEMFILE_MAX` are processed to avoid memory exhaustion...
Property method The ``REQUEST_METHOD`` value as an uppercase string.
Property params A :class:`FormsDict` with the combined values of :attr:`query` and :attr:`forms`. File uploads are stored in :attr:`files`.
Property path The value of ``PATH_INFO`` with exactly one prefixed slash (to fix broken clients and avoid the "empty path" edge case).
Property POST The values of :attr:`forms` and :attr:`files` combined into a single :class:`FormsDict`. Values are either strings (form values) or instances of :class:`cgi.FieldStorage` (file uploads).
Property query The :attr:`query_string` parsed into a :class:`FormsDict`. These values are sometimes called "URL arguments" or "GET parameters", but not to be confused with "URL wildcards" as they are provided by the :class:`Router`...
Property query_string The raw :attr:`query` part of the URL (everything in between ``?`` and ``#``) as a string.
Property remote_addr The client IP as a string. Note that this information can be forged by malicious clients.
Property remote_route A list of all IPs that were involved in this request, starting with the client IP and followed by zero or more proxies. This does only work if all proxies support the ```X-Forwarded-For`` header. Note that this information can be forged by malicious clients...
Property route The bottle :class:`Route` object that matches this request.
Property script_name The initial portion of the URL's `path` that was removed by a higher level (server or routing middleware) before the application was called. This script path is returned with leading and tailing slashes...
Property url The full request URI including hostname and scheme. If your app lives behind a reverse proxy or load balancer and you get confusing results, make sure that the ``X-Forwarded-Host`` header is set correctly...
Property url_args The arguments extracted from the URL.
Property urlparts The :attr:`url` string as an :class:`urlparse.SplitResult` tuple. The tuple contains (scheme, host, path, query_string and fragment), but the fragment is always empty because it is not visible to the server...
Method _get_body_string read body until content-length or MEMFILE_MAX into a string. Raise HTTPError(413) on requests that are to large.
Method _iter_body Undocumented
Method _iter_chunked Undocumented
Property _body Undocumented

Undocumented