Simple class that stores security context information in the web request.
Projects should subclass this class if they wish to enhance the request context or provide additional information in their specific WSGI pipeline.
Bases: object
Helper class to represent useful information about a request context.
Stores information about the security context under which the user accesses the system, as well as additional request information.
Find an arg of type RequestContext and return it.
This is useful in a couple of decorators where we don’t know much about the function we’re wrapping.
Import related utilities and helper functions.
Returns a class from a string including module and class.
Import a module.
Import a class and return an instance of it.
Tries to import object from default namespace.
Imports a class and return an instance of it, first by trying to find the class in a default namespace, then failing back to a full path if not found in the default namespace.
Try to import a module and if it fails return default.
Local storage of variables using weak references
Bases: thread._local
Network-related utilities and helper functions.
Interpret a string as a host:port pair.
An IPv6 address MUST be escaped if accompanied by a port, because otherwise ambiguity ensues: 2001:db8:85a3::8a2e:370:7334 means both [2001:db8:85a3::8a2e:370:7334] and [2001:db8:85a3::8a2e:370]:7334.
>>> parse_host_port('server01:80')
('server01', 80)
>>> parse_host_port('server01')
('server01', None)
>>> parse_host_port('server01', default_port=1234)
('server01', 1234)
>>> parse_host_port('[::1]:80')
('::1', 80)
>>> parse_host_port('[::1]')
('::1', None)
>>> parse_host_port('[::1]', default_port=1234)
('::1', 1234)
>>> parse_host_port('2001:db8:85a3::8a2e:370:7334', default_port=1234)
('2001:db8:85a3::8a2e:370:7334', 1234)
Parse a URL using urlparse.urlsplit(), splitting query and fragments. This function papers over Python issue9374 when needed.
The parameters are the same as urlparse.urlsplit.
UUID related utilities and helper functions.
Returns validation of a value as a UUID.
For our purposes, a UUID is a canonical form string: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa