request
core.request
请求描述符与批量请求容器. 提供对 API 请求的抽象与调度.
Request
dataclass
Request(
*,
_client: Client,
module: str,
method: str,
param: dict[str, Any] | dict[int, Any],
response_model: type[BaseModel] | None = None,
comm: dict[str, int | str | bool] | None = None,
override_comm: bool = False,
is_jce: bool = False,
preserve_bool: bool = False,
credential: Credential | None = None,
platform: Platform | None = None,
allow_error_codes: AllowErrorCodes | None = None,
parse_on_allow: bool = False,
sign: bool = False,
)
Bases: Generic[RequestResultT]
请求描述符.
replace
返回一个应用了修改的新 Request 对象, 不会修改原对象.
Source code in qqmusic_api/core/request.py
PaginatedRequest
dataclass
PaginatedRequest(
pager_meta: PagerMeta,
*,
_client: Client,
module: str,
method: str,
param: dict[str, Any] | dict[int, Any],
response_model: type[BaseModel] | None = None,
comm: dict[str, int | str | bool] | None = None,
override_comm: bool = False,
is_jce: bool = False,
preserve_bool: bool = False,
credential: Credential | None = None,
platform: Platform | None = None,
allow_error_codes: AllowErrorCodes | None = None,
parse_on_allow: bool = False,
sign: bool = False,
)
Bases: Request[RequestResultT]
声明了连续翻页能力的请求描述符.
get_pager_meta
get_pager_meta() -> PagerMeta
paginate
paginate(
limit: int | None = None,
) -> ResponsePager[RequestResultT]
返回响应的分页迭代器.
| PARAMETER | DESCRIPTION |
|---|---|
limit
|
最大获取页数.
TYPE:
|
RefreshableRequest
dataclass
RefreshableRequest(
refresh_meta: RefreshMeta,
*,
_client: Client,
module: str,
method: str,
param: dict[str, Any] | dict[int, Any],
response_model: type[BaseModel] | None = None,
comm: dict[str, int | str | bool] | None = None,
override_comm: bool = False,
is_jce: bool = False,
preserve_bool: bool = False,
credential: Credential | None = None,
platform: Platform | None = None,
allow_error_codes: AllowErrorCodes | None = None,
parse_on_allow: bool = False,
sign: bool = False,
)
Bases: Request[RequestResultT]
声明了换一批能力的请求描述符.
get_refresh_meta
get_refresh_meta() -> RefreshMeta
refresh
refresh() -> ResponseRefresher[RequestResultT]