OpenQuizz
Une application de gestion des contenus pédagogiques
|
Public Member Functions | |
def | __init__ (self, application, response_wrapper=None, use_cookies=True, allow_subdomain_redirects=False) |
def | set_cookie (self, server_name, key, value="", max_age=None, expires=None, path="/", domain=None, secure=None, httponly=False, samesite=None, charset="utf-8") |
def | delete_cookie (self, server_name, key, path="/", domain=None) |
def | run_wsgi_app (self, environ, buffered=False) |
def | resolve_redirect (self, response, new_location, environ, buffered=False) |
def | open (self, *args, **kwargs) |
def | get (self, *args, **kw) |
def | patch (self, *args, **kw) |
def | post (self, *args, **kw) |
def | head (self, *args, **kw) |
def | put (self, *args, **kw) |
def | delete (self, *args, **kw) |
def | options (self, *args, **kw) |
def | trace (self, *args, **kw) |
def | __repr__ (self) |
Data Fields | |
application | |
response_wrapper | |
cookie_jar | |
allow_subdomain_redirects | |
This class allows you to send requests to a wrapped application. The response wrapper can be a class or factory function that takes three arguments: app_iter, status and headers. The default response wrapper just returns a tuple. Example:: class ClientResponse(BaseResponse): ... client = Client(MyApplication(), response_wrapper=ClientResponse) The use_cookies parameter indicates whether cookies should be stored and sent for subsequent requests. This is True by default, but passing False will disable this behaviour. If you want to request some subdomain of your application you may set `allow_subdomain_redirects` to `True` as if not no external redirects are allowed. .. versionadded:: 0.5 `use_cookies` is new in this version. Older versions did not provide builtin cookie support. .. versionadded:: 0.14 The `mimetype` parameter was added. .. versionadded:: 0.15 The ``json`` parameter.
def __init__ | ( | self, | |
application, | |||
response_wrapper = None , |
|||
use_cookies = True , |
|||
allow_subdomain_redirects = False |
|||
) |
def __repr__ | ( | self | ) |
def delete | ( | self, | |
* | args, | ||
** | kw | ||
) |
Like open but method is enforced to DELETE.
def delete_cookie | ( | self, | |
server_name, | |||
key, | |||
path = "/" , |
|||
domain = None |
|||
) |
Deletes a cookie in the test client.
def get | ( | self, | |
* | args, | ||
** | kw | ||
) |
Like open but method is enforced to GET.
def head | ( | self, | |
* | args, | ||
** | kw | ||
) |
Like open but method is enforced to HEAD.
def open | ( | self, | |
* | args, | ||
** | kwargs | ||
) |
Takes the same arguments as the :class:`EnvironBuilder` class with some additions: You can provide a :class:`EnvironBuilder` or a WSGI environment as only argument instead of the :class:`EnvironBuilder` arguments and two optional keyword arguments (`as_tuple`, `buffered`) that change the type of the return value or the way the application is executed. .. versionchanged:: 0.5 If a dict is provided as file in the dict for the `data` parameter the content type has to be called `content_type` now instead of `mimetype`. This change was made for consistency with :class:`werkzeug.FileWrapper`. The `follow_redirects` parameter was added to :func:`open`. Additional parameters: :param as_tuple: Returns a tuple in the form ``(environ, result)`` :param buffered: Set this to True to buffer the application run. This will automatically close the application for you as well. :param follow_redirects: Set this to True if the `Client` should follow HTTP redirects.
Reimplemented in FlaskClient.
def options | ( | self, | |
* | args, | ||
** | kw | ||
) |
Like open but method is enforced to OPTIONS.
def patch | ( | self, | |
* | args, | ||
** | kw | ||
) |
Like open but method is enforced to PATCH.
def post | ( | self, | |
* | args, | ||
** | kw | ||
) |
Like open but method is enforced to POST.
def put | ( | self, | |
* | args, | ||
** | kw | ||
) |
Like open but method is enforced to PUT.
def resolve_redirect | ( | self, | |
response, | |||
new_location, | |||
environ, | |||
buffered = False |
|||
) |
Perform a new request to the location given by the redirect response to the previous request.
def run_wsgi_app | ( | self, | |
environ, | |||
buffered = False |
|||
) |
Runs the wrapped WSGI app with the given environment.
def set_cookie | ( | self, | |
server_name, | |||
key, | |||
value = "" , |
|||
max_age = None , |
|||
expires = None , |
|||
path = "/" , |
|||
domain = None , |
|||
secure = None , |
|||
httponly = False , |
|||
samesite = None , |
|||
charset = "utf-8" |
|||
) |
Sets a cookie in the client's cookie jar. The server name is required and has to match the one that is also passed to the open call.
def trace | ( | self, | |
* | args, | ||
** | kw | ||
) |
Like open but method is enforced to TRACE.
allow_subdomain_redirects |
application |
cookie_jar |
response_wrapper |