doc_content stringlengths 1 386k | doc_id stringlengths 5 188 |
|---|---|
werkzeug.wsgi.get_current_url(environ, root_only=False, strip_querystring=False, host_only=False, trusted_hosts=None)
Recreate the URL for a request from the parts in a WSGI environment. The URL is an IRI, not a URI, so it may contain Unicode characters. Use iri_to_uri() to convert it to ASCII. Parameters
environ... | werkzeug.wsgi.index#werkzeug.wsgi.get_current_url |
werkzeug.filesystem.get_filesystem_encoding()
Returns the filesystem encoding that should be used. Note that this is different from the Python understanding of the filesystem encoding which might be deeply flawed. Do not use this value against Python’s string APIs because it might be different. See The Filesystem for... | werkzeug.filesystem.index#werkzeug.filesystem.get_filesystem_encoding |
werkzeug.wsgi.get_host(environ, trusted_hosts=None)
Return the host for the given WSGI environment. The Host header is preferred, then SERVER_NAME if it’s not set. The returned host will only contain the port if it is different than the standard port for the protocol. Optionally, verify that the host is trusted using... | werkzeug.wsgi.index#werkzeug.wsgi.get_host |
werkzeug.wsgi.get_input_stream(environ, safe_fallback=True)
Returns the input stream from the WSGI environment and wraps it in the most sensible way possible. The stream returned is not the raw WSGI stream in most cases but one that is safe to read from without taking into account the content length. If content lengt... | werkzeug.wsgi.index#werkzeug.wsgi.get_input_stream |
werkzeug.wsgi.get_path_info(environ, charset='utf-8', errors='replace')
Return the PATH_INFO from the WSGI environment and decode it unless charset is None. Parameters
environ (WSGIEnvironment) – WSGI environment to get the path from.
charset (str) – The charset for the path info, or None if no decoding should b... | werkzeug.wsgi.index#werkzeug.wsgi.get_path_info |
werkzeug.wsgi.get_query_string(environ)
Returns the QUERY_STRING from the WSGI environment. This also takes care of the WSGI decoding dance. The string returned will be restricted to ASCII characters. Parameters
environ (WSGIEnvironment) – WSGI environment to get the query string from. Return type
str Changelo... | werkzeug.wsgi.index#werkzeug.wsgi.get_query_string |
werkzeug.wsgi.get_script_name(environ, charset='utf-8', errors='replace')
Return the SCRIPT_NAME from the WSGI environment and decode it unless charset is set to None. Parameters
environ (WSGIEnvironment) – WSGI environment to get the path from.
charset (str) – The charset for the path, or None if no decoding sh... | werkzeug.wsgi.index#werkzeug.wsgi.get_script_name |
class werkzeug.datastructures.Headers([defaults])
An object that stores some headers. It has a dict-like interface, but is ordered, can store the same key multiple times, and iterating yields (key, value) pairs instead of only keys. This data structure is useful if you want a nicer way to handle WSGI headers which ar... | werkzeug.datastructures.index#werkzeug.datastructures.Headers |
add(_key, _value, **kw)
Add a new header tuple to the list. Keyword arguments can specify additional parameters for the header value, with underscores converted to dashes: >>> d = Headers()
>>> d.add('Content-Type', 'text/plain')
>>> d.add('Content-Disposition', 'attachment', filename='foo.png')
The keyword argument... | werkzeug.datastructures.index#werkzeug.datastructures.Headers.add |
add_header(_key, _value, **_kw)
Add a new header tuple to the list. An alias for add() for compatibility with the wsgiref add_header() method. | werkzeug.datastructures.index#werkzeug.datastructures.Headers.add_header |
clear()
Clears all headers. | werkzeug.datastructures.index#werkzeug.datastructures.Headers.clear |
extend(*args, **kwargs)
Extend headers in this object with items from another object containing header items as well as keyword arguments. To replace existing keys instead of extending, use update() instead. If provided, the first argument can be another Headers object, a MultiDict, dict, or iterable of pairs. Chang... | werkzeug.datastructures.index#werkzeug.datastructures.Headers.extend |
get(key, default=None, type=None, as_bytes=False)
Return the default value if the requested data doesn’t exist. If type is provided and is a callable it should convert the value, return it or raise a ValueError if that is not possible. In this case the function will return the default as if the value was not found: >... | werkzeug.datastructures.index#werkzeug.datastructures.Headers.get |
getlist(key, type=None, as_bytes=False)
Return the list of items for a given key. If that key is not in the Headers, the return value will be an empty list. Just like get(), getlist() accepts a type parameter. All items will be converted with the callable defined there. Changelog New in version 0.9: Added support fo... | werkzeug.datastructures.index#werkzeug.datastructures.Headers.getlist |
get_all(name)
Return a list of all the values for the named field. This method is compatible with the wsgiref get_all() method. | werkzeug.datastructures.index#werkzeug.datastructures.Headers.get_all |
has_key(key)
Deprecated since version 2.0: Will be removed in Werkzeug 2.1. Use key in data instead. | werkzeug.datastructures.index#werkzeug.datastructures.Headers.has_key |
pop(key=None, default=no value)
Removes and returns a key or index. Parameters
key – The key to be popped. If this is an integer the item at that position is removed, if it’s a string the value for that key is. If the key is omitted or None the last item is removed. Returns
an item. | werkzeug.datastructures.index#werkzeug.datastructures.Headers.pop |
popitem()
Removes a key or index and returns a (key, value) item. | werkzeug.datastructures.index#werkzeug.datastructures.Headers.popitem |
remove(key)
Remove a key. Parameters
key – The key to be removed. | werkzeug.datastructures.index#werkzeug.datastructures.Headers.remove |
set(_key, _value, **kw)
Remove all header tuples for key and add a new one. The newly added key either appears at the end of the list if there was no entry or replaces the first one. Keyword arguments can specify additional parameters for the header value, with underscores converted to dashes. See add() for more info... | werkzeug.datastructures.index#werkzeug.datastructures.Headers.set |
setdefault(key, default)
Return the first value for the key if it is in the headers, otherwise set the header to the value given by default and return that. Parameters
key – The header key to get.
default – The value to set for the key if it is not in the headers. | werkzeug.datastructures.index#werkzeug.datastructures.Headers.setdefault |
setlist(key, values)
Remove any existing values for a header and add new ones. Parameters
key – The header key to set.
values – An iterable of values to set for the key. Changelog New in version 1.0. | werkzeug.datastructures.index#werkzeug.datastructures.Headers.setlist |
setlistdefault(key, default)
Return the list of values for the key if it is in the headers, otherwise set the header to the list of values given by default and return that. Unlike MultiDict.setlistdefault(), modifying the returned list will not affect the headers. Parameters
key – The header key to get.
default ... | werkzeug.datastructures.index#werkzeug.datastructures.Headers.setlistdefault |
to_wsgi_list()
Convert the headers into a list suitable for WSGI. Returns
list | werkzeug.datastructures.index#werkzeug.datastructures.Headers.to_wsgi_list |
update(*args, **kwargs)
Replace headers in this object with items from another headers object and keyword arguments. To extend existing keys instead of replacing, use extend() instead. If provided, the first argument can be another Headers object, a MultiDict, dict, or iterable of pairs. Changelog New in version 1.0... | werkzeug.datastructures.index#werkzeug.datastructures.Headers.update |
class werkzeug.datastructures.HeaderSet(headers=None, on_update=None)
Similar to the ETags class this implements a set-like structure. Unlike ETags this is case insensitive and used for vary, allow, and content-language headers. If not constructed using the parse_set_header() function the instantiation works like thi... | werkzeug.datastructures.index#werkzeug.datastructures.HeaderSet |
add(header)
Add a new header to the set. | werkzeug.datastructures.index#werkzeug.datastructures.HeaderSet.add |
as_set(preserve_casing=False)
Return the set as real python set type. When calling this, all the items are converted to lowercase and the ordering is lost. Parameters
preserve_casing – if set to True the items in the set returned will have the original case like in the HeaderSet, otherwise they will be lowercase. | werkzeug.datastructures.index#werkzeug.datastructures.HeaderSet.as_set |
clear()
Clear the set. | werkzeug.datastructures.index#werkzeug.datastructures.HeaderSet.clear |
discard(header)
Like remove() but ignores errors. Parameters
header – the header to be discarded. | werkzeug.datastructures.index#werkzeug.datastructures.HeaderSet.discard |
find(header)
Return the index of the header in the set or return -1 if not found. Parameters
header – the header to be looked up. | werkzeug.datastructures.index#werkzeug.datastructures.HeaderSet.find |
index(header)
Return the index of the header in the set or raise an IndexError. Parameters
header – the header to be looked up. | werkzeug.datastructures.index#werkzeug.datastructures.HeaderSet.index |
remove(header)
Remove a header from the set. This raises an KeyError if the header is not in the set. Changelog Changed in version 0.5: In older versions a IndexError was raised instead of a KeyError if the object was missing. Parameters
header – the header to be removed. | werkzeug.datastructures.index#werkzeug.datastructures.HeaderSet.remove |
to_header()
Convert the header set into an HTTP header string. | werkzeug.datastructures.index#werkzeug.datastructures.HeaderSet.to_header |
update(iterable)
Add all the headers from the iterable to the set. Parameters
iterable – updates the set with the items from the iterable. | werkzeug.datastructures.index#werkzeug.datastructures.HeaderSet.update |
class werkzeug.utils.header_property(name, default=None, load_func=None, dump_func=None, read_only=None, doc=None)
Like environ_property but for headers. | werkzeug.utils.index#werkzeug.utils.header_property |
werkzeug.wsgi.host_is_trusted(hostname, trusted_list)
Check if a host matches a list of trusted names. Parameters
hostname (str) – The name to check.
trusted_list (Iterable[str]) – A list of valid names to match. If a name starts with a dot it will match all subdomains. Return type
bool Changelog New in ve... | werkzeug.wsgi.index#werkzeug.wsgi.host_is_trusted |
class werkzeug.urls.Href(base='./', charset='utf-8', sort=False, key=None)
Implements a callable that constructs URLs with the given base. The function can be called with any number of positional and keyword arguments which than are used to assemble the URL. Works with URLs and posix paths. Positional arguments are a... | werkzeug.urls.index#werkzeug.urls.Href |
class werkzeug.utils.HTMLBuilder(dialect)
Helper object for HTML generation. Per default there are two instances of that class. The html one, and the xhtml one for those two dialects. The class uses keyword parameters and positional parameters to generate small snippets of HTML. Keyword parameters are converted to XM... | werkzeug.utils.index#werkzeug.utils.HTMLBuilder |
get_response(environ=None, scope=None)
Get a response object. If one was passed to the exception it’s returned directly. Parameters
environ (Optional[WSGIEnvironment]) – the optional environ for the request. This can be used to modify the response depending on how the request looked like.
scope (Optional[dict]) ... | werkzeug.exceptions.index#werkzeug.exceptions.HTTPException.get_response |
__call__(environ, start_response)
Call the exception as WSGI application. Parameters
environ (WSGIEnvironment) – the WSGI environment.
start_response (StartResponse) – the response callable provided by the WSGI server. Return type
Iterable[bytes] | werkzeug.exceptions.index#werkzeug.exceptions.HTTPException.__call__ |
werkzeug.http.http_date(timestamp=None)
Format a datetime object or timestamp into an RFC 2822 date string. This is a wrapper for email.utils.format_datetime(). It assumes naive datetime objects are in UTC instead of raising an exception. Parameters
timestamp (Optional[Union[datetime.datetime, datetime.date, int, f... | werkzeug.http.index#werkzeug.http.http_date |
class werkzeug.datastructures.IfRange(etag=None, date=None)
Very simple object that represents the If-Range header in parsed form. It will either have neither a etag or date or one of either but never both. Changelog New in version 0.7.
date
The date in parsed format or None.
etag
The etag parsed and unqu... | werkzeug.datastructures.index#werkzeug.datastructures.IfRange |
date
The date in parsed format or None. | werkzeug.datastructures.index#werkzeug.datastructures.IfRange.date |
etag
The etag parsed and unquoted. Ranges always operate on strong etags so the weakness information is not necessary. | werkzeug.datastructures.index#werkzeug.datastructures.IfRange.etag |
to_header()
Converts the object back into an HTTP header. | werkzeug.datastructures.index#werkzeug.datastructures.IfRange.to_header |
class werkzeug.datastructures.ImmutableDict
An immutable dict. Changelog New in version 0.5.
copy()
Return a shallow mutable copy of this object. Keep in mind that the standard library’s copy() function is a no-op for this class like for any other python immutable type (eg: tuple). | werkzeug.datastructures.index#werkzeug.datastructures.ImmutableDict |
copy()
Return a shallow mutable copy of this object. Keep in mind that the standard library’s copy() function is a no-op for this class like for any other python immutable type (eg: tuple). | werkzeug.datastructures.index#werkzeug.datastructures.ImmutableDict.copy |
class werkzeug.datastructures.ImmutableList(iterable=(), /)
An immutable list. Changelog New in version 0.5. Private | werkzeug.datastructures.index#werkzeug.datastructures.ImmutableList |
class werkzeug.datastructures.ImmutableMultiDict(mapping=None)
An immutable MultiDict. Changelog New in version 0.5.
copy()
Return a shallow mutable copy of this object. Keep in mind that the standard library’s copy() function is a no-op for this class like for any other python immutable type (eg: tuple). | werkzeug.datastructures.index#werkzeug.datastructures.ImmutableMultiDict |
copy()
Return a shallow mutable copy of this object. Keep in mind that the standard library’s copy() function is a no-op for this class like for any other python immutable type (eg: tuple). | werkzeug.datastructures.index#werkzeug.datastructures.ImmutableMultiDict.copy |
class werkzeug.datastructures.ImmutableOrderedMultiDict(mapping=None)
An immutable OrderedMultiDict. Changelog New in version 0.6.
copy()
Return a shallow mutable copy of this object. Keep in mind that the standard library’s copy() function is a no-op for this class like for any other python immutable type (eg:... | werkzeug.datastructures.index#werkzeug.datastructures.ImmutableOrderedMultiDict |
copy()
Return a shallow mutable copy of this object. Keep in mind that the standard library’s copy() function is a no-op for this class like for any other python immutable type (eg: tuple). | werkzeug.datastructures.index#werkzeug.datastructures.ImmutableOrderedMultiDict.copy |
class werkzeug.datastructures.ImmutableTypeConversionDict
Works like a TypeConversionDict but does not support modifications. Changelog New in version 0.5.
copy()
Return a shallow mutable copy of this object. Keep in mind that the standard library’s copy() function is a no-op for this class like for any other p... | werkzeug.datastructures.index#werkzeug.datastructures.ImmutableTypeConversionDict |
copy()
Return a shallow mutable copy of this object. Keep in mind that the standard library’s copy() function is a no-op for this class like for any other python immutable type (eg: tuple). | werkzeug.datastructures.index#werkzeug.datastructures.ImmutableTypeConversionDict.copy |
werkzeug.utils.import_string(import_name, silent=False)
Imports an object based on a string. This is useful if you want to use import paths as endpoints or something similar. An import path can be specified either in dotted notation (xml.sax.saxutils.escape) or with a colon as object delimiter (xml.sax.saxutils:escap... | werkzeug.utils.index#werkzeug.utils.import_string |
Installation Python Version We recommend using the latest version of Python. Werkzeug supports Python 3.6 and newer. Dependencies Werkzeug does not have any direct dependencies. Optional dependencies These distributions will not be installed automatically. Werkzeug will detect and use them if you install them.
Co... | werkzeug.installation.index |
class werkzeug.routing.IntegerConverter(map, fixed_digits=0, min=None, max=None, signed=False)
This converter only accepts integer values: Rule("/page/<int:page>")
By default it only accepts unsigned, positive values. The signed parameter will enable signed, negative values. Rule("/page/<int(signed=True):page>")
P... | werkzeug.routing.index#werkzeug.routing.IntegerConverter |
original_exception
The original exception that caused this 500 error. Can be used by frameworks to provide context when handling unexpected errors. | werkzeug.exceptions.index#werkzeug.exceptions.InternalServerError.original_exception |
werkzeug.utils.invalidate_cached_property(obj, name)
Invalidates the cache for a cached_property: >>> class Test(object):
... @cached_property
... def magic_number(self):
... print("recalculating...")
... return 42
...
>>> var = Test()
>>> var.magic_number
recalculating...
42
>>> var.magic_num... | werkzeug.utils.index#werkzeug.utils.invalidate_cached_property |
werkzeug.urls.iri_to_uri(iri, charset='utf-8', errors='strict', safe_conversion=False)
Convert an IRI to a URI. All non-ASCII and unsafe characters are quoted. If the URL has a domain, it is encoded to Punycode. >>> iri_to_uri('http://\u2603.net/p\xe5th?q=\xe8ry%DF')
'http://xn--n3h.net/p%C3%A5th?q=%C3%A8ry%DF'
Par... | werkzeug.urls.index#werkzeug.urls.iri_to_uri |
werkzeug.http.is_byte_range_valid(start, stop, length)
Checks if a given byte content range is valid for the given length. Changelog New in version 0.7. Parameters
start (Optional[int]) –
stop (Optional[int]) –
length (Optional[int]) – Return type
bool | werkzeug.http.index#werkzeug.http.is_byte_range_valid |
werkzeug.http.is_entity_header(header)
Check if a header is an entity header. Changelog New in version 0.5. Parameters
header (str) – the header to test. Returns
True if it’s an entity header, False otherwise. Return type
bool | werkzeug.http.index#werkzeug.http.is_entity_header |
werkzeug.http.is_hop_by_hop_header(header)
Check if a header is an HTTP/1.1 “Hop-by-Hop” header. Changelog New in version 0.5. Parameters
header (str) – the header to test. Returns
True if it’s an HTTP/1.1 “Hop-by-Hop” header, False otherwise. Return type
bool | werkzeug.http.index#werkzeug.http.is_hop_by_hop_header |
werkzeug.http.is_resource_modified(environ, etag=None, data=None, last_modified=None, ignore_if_range=True)
Convenience method for conditional requests. Parameters
environ (WSGIEnvironment) – the WSGI environment of the request to be checked.
etag (Optional[str]) – the etag for the response for comparison.
data... | werkzeug.http.index#werkzeug.http.is_resource_modified |
werkzeug.serving.is_running_from_reloader()
Checks if the application is running from within the Werkzeug reloader subprocess. Changelog New in version 0.10. Return type
bool | werkzeug.serving.index#werkzeug.serving.is_running_from_reloader |
class werkzeug.datastructures.LanguageAccept(values=())
Like Accept but with normalization for language tags. | werkzeug.datastructures.index#werkzeug.datastructures.LanguageAccept |
class werkzeug.wsgi.LimitedStream(stream, limit)
Wraps a stream so that it doesn’t read more than n bytes. If the stream is exhausted and the caller tries to get more bytes from it on_exhausted() is called which by default returns an empty string. The return value of that function is forwarded to the reader function.... | werkzeug.wsgi.index#werkzeug.wsgi.LimitedStream |
exhaust(chunk_size=65536)
Exhaust the stream. This consumes all the data left until the limit is reached. Parameters
chunk_size (int) – the size for a chunk. It will read the chunk until the stream is exhausted and throw away the results. Return type
None | werkzeug.wsgi.index#werkzeug.wsgi.LimitedStream.exhaust |
on_disconnect()
What should happen if a disconnect is detected? The return value of this function is returned from read functions in case the client went away. By default a ClientDisconnected exception is raised. Return type
bytes | werkzeug.wsgi.index#werkzeug.wsgi.LimitedStream.on_disconnect |
on_exhausted()
This is called when the stream tries to read past the limit. The return value of this function is returned from the reading function. Return type
bytes | werkzeug.wsgi.index#werkzeug.wsgi.LimitedStream.on_exhausted |
read(size=None)
Read size bytes or if size is not provided everything is read. Parameters
size (Optional[int]) – the number of bytes read. Return type
bytes | werkzeug.wsgi.index#werkzeug.wsgi.LimitedStream.read |
readable()
Return whether object was opened for reading. If False, read() will raise OSError. Return type
bool | werkzeug.wsgi.index#werkzeug.wsgi.LimitedStream.readable |
readline(size=None)
Reads one line from the stream. Parameters
size (Optional[int]) – Return type
bytes | werkzeug.wsgi.index#werkzeug.wsgi.LimitedStream.readline |
readlines(size=None)
Reads a file into a list of strings. It calls readline() until the file is read to the end. It does support the optional size argument if the underlying stream supports it for readline. Parameters
size (Optional[int]) – Return type
List[bytes] | werkzeug.wsgi.index#werkzeug.wsgi.LimitedStream.readlines |
tell()
Returns the position of the stream. Changelog New in version 0.9. Return type
int | werkzeug.wsgi.index#werkzeug.wsgi.LimitedStream.tell |
class werkzeug.middleware.lint.LintMiddleware(app)
Warns about common errors in the WSGI and HTTP behavior of the server and wrapped application. Some of the issues it checks are: invalid status codes non-bytes sent to the WSGI server strings returned from the WSGI application non-empty conditional responses unquote... | werkzeug.middleware.lint.index#werkzeug.middleware.lint.LintMiddleware |
class werkzeug.local.LocalManager(locals=None, ident_func=None)
Local objects cannot manage themselves. For that you need a local manager. You can pass a local manager multiple locals or add them later y appending them to manager.locals. Every time the manager cleans up, it will clean up all the data left in the loca... | werkzeug.local.index#werkzeug.local.LocalManager |
cleanup()
Manually clean up the data in the locals for this context. Call this at the end of the request or use make_middleware(). Return type
None | werkzeug.local.index#werkzeug.local.LocalManager.cleanup |
get_ident()
Return the context identifier the local objects use internally for this context. You cannot override this method to change the behavior but use it to link other context local objects (such as SQLAlchemy’s scoped sessions) to the Werkzeug locals. Deprecated since version 2.0: Will be removed in Werkzeug 2... | werkzeug.local.index#werkzeug.local.LocalManager.get_ident |
make_middleware(app)
Wrap a WSGI application so that cleaning up happens after request end. Parameters
app (WSGIApplication) – Return type
WSGIApplication | werkzeug.local.index#werkzeug.local.LocalManager.make_middleware |
middleware(func)
Like make_middleware but for decorating functions. Example usage: @manager.middleware
def application(environ, start_response):
...
The difference to make_middleware is that the function passed will have all the arguments copied from the inner application (name, docstring, module). Parameters
... | werkzeug.local.index#werkzeug.local.LocalManager.middleware |
class werkzeug.local.LocalProxy(local, name=None)
A proxy to the object bound to a Local. All operations on the proxy are forwarded to the bound object. If no object is bound, a RuntimeError is raised. from werkzeug.local import Local
l = Local()
# a proxy to whatever l.user is set to
user = l("user")
from werkzeug... | werkzeug.local.index#werkzeug.local.LocalProxy |
_get_current_object()
Return the current object. This is useful if you want the real object behind the proxy at a time for performance reasons or because you want to pass the object into a different context. Return type
Any | werkzeug.local.index#werkzeug.local.LocalProxy._get_current_object |
class werkzeug.local.LocalStack
This class works similar to a Local but keeps a stack of objects instead. This is best explained with an example: >>> ls = LocalStack()
>>> ls.push(42)
>>> ls.top
42
>>> ls.push(23)
>>> ls.top
23
>>> ls.pop()
23
>>> ls.top
42
They can be force released by using a LocalManager or with ... | werkzeug.local.index#werkzeug.local.LocalStack |
pop()
Removes the topmost item from the stack, will return the old value or None if the stack was already empty. Return type
Any | werkzeug.local.index#werkzeug.local.LocalStack.pop |
push(obj)
Pushes a new item to the stack Parameters
obj (Any) – Return type
List[Any] | werkzeug.local.index#werkzeug.local.LocalStack.push |
werkzeug.wsgi.make_chunk_iter(stream, separator, limit=None, buffer_size=10240, cap_at_buffer=False)
Works like make_line_iter() but accepts a separator which divides chunks. If you want newline based processing you should use make_line_iter() instead as it supports arbitrary newline markers. Changelog New in versio... | werkzeug.wsgi.index#werkzeug.wsgi.make_chunk_iter |
werkzeug.wsgi.make_line_iter(stream, limit=None, buffer_size=10240, cap_at_buffer=False)
Safely iterates line-based over an input stream. If the input stream is not a LimitedStream the limit parameter is mandatory. This uses the stream’s read() method internally as opposite to the readline() method that is unsafe and... | werkzeug.wsgi.index#werkzeug.wsgi.make_line_iter |
werkzeug.serving.make_ssl_devcert(base_path, host=None, cn=None)
Creates an SSL key for development. This should be used instead of the 'adhoc' key which generates a new cert on each server start. It accepts a path for where it should store the key and cert and either a host or CN. If a host is given it will use the ... | werkzeug.serving.index#werkzeug.serving.make_ssl_devcert |
class werkzeug.routing.Map(rules=None, default_subdomain='', charset='utf-8', strict_slashes=True, merge_slashes=True, redirect_defaults=True, converters=None, sort_parameters=False, sort_key=None, encoding_errors='replace', host_matching=False)
The map class stores all the URL rules and some configuration parameters... | werkzeug.routing.index#werkzeug.routing.Map |
add(rulefactory)
Add a new rule or factory to the map and bind it. Requires that the rule is not bound to another map. Parameters
rulefactory (werkzeug.routing.RuleFactory) – a Rule or RuleFactory Return type
None | werkzeug.routing.index#werkzeug.routing.Map.add |
bind(server_name, script_name=None, subdomain=None, url_scheme='http', default_method='GET', path_info=None, query_args=None)
Return a new MapAdapter with the details specified to the call. Note that script_name will default to '/' if not further specified or None. The server_name at least is a requirement because th... | werkzeug.routing.index#werkzeug.routing.Map.bind |
bind_to_environ(environ, server_name=None, subdomain=None)
Like bind() but you can pass it an WSGI environment and it will fetch the information from that dictionary. Note that because of limitations in the protocol there is no way to get the current subdomain and real server_name from the environment. If you don’t p... | werkzeug.routing.index#werkzeug.routing.Map.bind_to_environ |
converters
The dictionary of converters. This can be modified after the class was created, but will only affect rules added after the modification. If the rules are defined with the list passed to the class, the converters parameter to the constructor has to be used instead. | werkzeug.routing.index#werkzeug.routing.Map.converters |
default_converters = {'any': <class 'werkzeug.routing.AnyConverter'>, 'default': <class 'werkzeug.routing.UnicodeConverter'>, 'float': <class 'werkzeug.routing.FloatConverter'>, 'int': <class 'werkzeug.routing.IntegerConverter'>, 'path': <class 'werkzeug.routing.PathConverter'>, 'string': <class 'werkzeug.routing.Unico... | werkzeug.routing.index#werkzeug.routing.Map.default_converters |
is_endpoint_expecting(endpoint, *arguments)
Iterate over all rules and check if the endpoint expects the arguments provided. This is for example useful if you have some URLs that expect a language code and others that do not and you want to wrap the builder a bit so that the current language code is automatically add... | werkzeug.routing.index#werkzeug.routing.Map.is_endpoint_expecting |
iter_rules(endpoint=None)
Iterate over all rules or the rules of an endpoint. Parameters
endpoint (Optional[str]) – if provided only the rules for that endpoint are returned. Returns
an iterator Return type
Iterator[werkzeug.routing.Rule] | werkzeug.routing.index#werkzeug.routing.Map.iter_rules |
lock_class()
The type of lock to use when updating. Changelog New in version 1.0. | werkzeug.routing.index#werkzeug.routing.Map.lock_class |
update()
Called before matching and building to keep the compiled rules in the correct order after things changed. Return type
None | werkzeug.routing.index#werkzeug.routing.Map.update |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.