module documentation

Undocumented

Class Client This class allows you to send requests to a wrapped application.
Class EnvironBuilder This class can be used to conveniently create a WSGI environment for testing purposes. It can be used to quickly create WSGI environments or request objects from arbitrary data.
Class TestResponse :class:`~werkzeug.wrappers.Response` subclass that provides extra information about requests made with the test :class:`Client`.
Exception ClientRedirectError If a redirect loop is detected when using follow_redirects=True with the :cls:`Client`, then this exception is raised.
Function create_environ Create a new WSGI environ dict based on the values passed. The first parameter should be the path of the request which defaults to '/'. The second one can either be an absolute path (in that case the host is localhost:80) or a full path to the request with scheme, netloc port and the path to the script.
Function encode_multipart Like `stream_encode_multipart` but returns a tuple in the form (``boundary``, ``data``) where data is bytes.
Function run_wsgi_app Return a tuple in the form (app_iter, status, headers) of the application output. This works best if you pass it an application that returns an iterator all the time.
Function stream_encode_multipart Encode a dict of values (either strings or file descriptors or :class:`FileStorage` objects.) into a multipart encoded string stored in a file descriptor.
Class _TestCookieHeaders A headers adapter for cookielib
Class _TestCookieJar A cookielib.CookieJar modified to inject and read cookie headers from and to wsgi environments, and wsgi application responses.
Class _TestCookieResponse Something that looks like a httplib.HTTPResponse, but is actually just an adapter for our test responses to make them available for cookielib.
Function _iter_data Iterate over a mapping that might have a list of values, yielding all key, value pairs. Almost like iter_multi_items but only allows lists, not tuples, of values so tuples can be used for files.
Type Variable _TAnyMultiDict Undocumented
def create_environ(*args: t.Any, **kwargs: t.Any) -> WSGIEnvironment: (source)

Create a new WSGI environ dict based on the values passed. The first parameter should be the path of the request which defaults to '/'. The second one can either be an absolute path (in that case the host is localhost:80) or a full path to the request with scheme, netloc port and the path to the script. This accepts the same arguments as the :class:`EnvironBuilder` constructor. .. versionchanged:: 0.5 This function is now a thin wrapper over :class:`EnvironBuilder` which was added in 0.5. The `headers`, `environ_base`, `environ_overrides` and `charset` parameters were added.

def encode_multipart(values: t.Mapping[str, t.Any], boundary: t.Optional[str] = None, charset: str = 'utf-8') -> t.Tuple[str, bytes]: (source)

Like `stream_encode_multipart` but returns a tuple in the form (``boundary``, ``data``) where data is bytes.

def run_wsgi_app(app: WSGIApplication, environ: WSGIEnvironment, buffered: bool = False) -> t.Tuple[t.Iterable[bytes], str, Headers]: (source)

Return a tuple in the form (app_iter, status, headers) of the application output. This works best if you pass it an application that returns an iterator all the time. Sometimes applications may use the `write()` callable returned by the `start_response` function. This tries to resolve such edge cases automatically. But if you don't get the expected output you should set `buffered` to `True` which enforces buffering. If passed an invalid WSGI application the behavior of this function is undefined. Never pass non-conforming WSGI applications to this function. :param app: the application to execute. :param buffered: set to `True` to enforce buffering. :return: tuple in the form ``(app_iter, status, headers)``

def stream_encode_multipart(data: t.Mapping[str, t.Any], use_tempfile: bool = True, threshold: int = 1024*500, boundary: t.Optional[str] = None, charset: str = 'utf-8') -> t.Tuple[t.IO[bytes], int, str]: (source)

Encode a dict of values (either strings or file descriptors or :class:`FileStorage` objects.) into a multipart encoded string stored in a file descriptor.

Iterate over a mapping that might have a list of values, yielding all key, value pairs. Almost like iter_multi_items but only allows lists, not tuples, of values so tuples can be used for files.

_TAnyMultiDict = (source)

Undocumented

Value
t.TypeVar('_TAnyMultiDict',
          bound=MultiDict)