quart.testing.client 模块#

class quart.testing.client.QuartClient(app: Quart, use_cookies: bool = True)#

基类:object

async delete(*args: Any, **kwargs: Any) Response#

发出 DELETE 请求。

查看 open() 获取参数详情。

删除 cookie(设置为立即过期)。

async get(*args: Any, **kwargs: Any) Response#

发出 GET 请求。

查看 open() 获取参数详情。

async head(*args: Any, **kwargs: Any) Response#

发出 HEAD 请求。

查看 open() 获取参数详情。

http_connection_class#

的别名 TestHTTPConnection

async open(path: str, *, method: str = 'GET', headers: dict | ~werkzeug.datastructures.headers.Headers | None = None, data: AnyStr | None = None, form: dict | None = None, files: dict[str, ~quart.datastructures.FileStorage] | None = None, query_string: dict | None = None, json: ~typing.Any = <object object>, scheme: str = 'http', follow_redirects: bool = False, root_path: str = '', http_version: str = '1.1', scope_base: dict | None = None, auth: ~werkzeug.datastructures.auth.Authorization | tuple[str, str] | None = None, subdomain: str | None = None) Response#
async options(*args: Any, **kwargs: Any) Response#

发出 OPTIONS 请求。

查看 open() 获取参数详情。

async patch(*args: Any, **kwargs: Any) Response#

发出 PATCH 请求。

查看 open() 获取参数详情。

async post(*args: Any, **kwargs: Any) Response#

发出 POST 请求。

查看 open() 获取参数详情。

async put(*args: Any, **kwargs: Any) Response#

发出 PUT 请求。

查看 open() 获取参数详情。

request(path: str, *, method: str = 'GET', headers: dict | Headers | None = None, query_string: dict | None = None, scheme: str = 'http', root_path: str = '', http_version: str = '1.1', scope_base: dict | None = None, auth: Authorization | tuple[str, str] | None = None, subdomain: str | None = None) TestHTTPConnectionProtocol#
session_transaction(path: str = '/', *, method: str = 'GET', headers: dict | ~werkzeug.datastructures.headers.Headers | None = None, query_string: dict | None = None, scheme: str = 'http', data: AnyStr | None = None, form: dict | None = None, json: ~typing.Any = <object object>, root_path: str = '', http_version: str = '1.1', auth: ~werkzeug.datastructures.auth.Authorization | tuple[str, str] | None = None) AsyncGenerator[SessionMixin, None]#

在 cookie 罐中设置 cookie。

参数是标准 cookie 小片段,这是对 stdlib SimpleCookie 代码的包装器。

async trace(*args: Any, **kwargs: Any) Response#

发出 TRACE 请求。

查看 open() 获取参数详情。

websocket(path: str, *, headers: dict | Headers | None = None, query_string: dict | None = None, scheme: str = 'ws', subprotocols: list[str] | None = None, root_path: str = '', http_version: str = '1.1', scope_base: dict | None = None, auth: Authorization | tuple[str, str] | None = None, subdomain: str | None = None) TestWebsocketConnectionProtocol#
websocket_connection_class#

alias of TestWebsocketConnection