utils.network
网络请求
api_request
api_request(module: str, method: str, *, verify: bool = False, ignore_code: bool = False, process_bool: bool = True, cache_ttl: int | None = None, cacheable: bool = True, exclude_params: list[str] = [], catch_error_code: list[int] = [])
API请求
Source code in qqmusic_api/utils/network.py
BaseRequest
BaseRequest(common: dict[str, Any] | None = None, credential: Credential | None = None, verify: bool = False, ignore_code: bool = False)
Bases: ABC
请求基类
Source code in qqmusic_api/utils/network.py
commom
build_request_data
abstractmethod
build_request
统一构建请求参数
Source code in qqmusic_api/utils/network.py
request
async
执行请求
Source code in qqmusic_api/utils/network.py
ApiRequest
ApiRequest(module: str, method: str, api_func: Callable[_P, Coroutine[None, None, tuple[dict[Any, Any], Callable[[dict[str, Any]], _R]]]] | None = None, *, params: dict[str, Any] | None = None, common: dict[str, Any] | None = None, credential: Credential | None = None, verify: bool = False, ignore_code: bool = False, process_bool: bool = True, cache_ttl: int | None = None, cacheable: bool = True, exclude_params: list[str] = [], catch_error_code: list[int] = [])
Bases: BaseRequest
, Generic[_P, _R]
API 请求处理器
Source code in qqmusic_api/utils/network.py
copy
copy() -> ApiRequest[_P, _R]
创建当前 ApiRequest 实例的副本
Source code in qqmusic_api/utils/network.py
build_request_data
RequestItem
RequestGroup
RequestGroup(common: dict[str, Any] | None = None, credential: Credential | None = None, limit: int = 30)
Bases: BaseRequest
合并多个 API 请求,支持组级公共参数和重复模块方法处理
Source code in qqmusic_api/utils/network.py
add_request
add_request(request: ApiRequest[_P, _R], *args: args, **kwargs: kwargs) -> None
添加请求,自动生成唯一键
Source code in qqmusic_api/utils/network.py
build_request_data
execute
async
执行合并请求