utils.session
请求 Session 管理
ApiConfig
ORJsonSerializer
Bases: BaseSerializer
Transform data to json string with json.dumps and json.loads to retrieve it back.
dumps
Session
Session(*, credential: Credential | None = None, enable_sign: bool = False, enable_cache: bool = True, cache_ttl: int = 120, http2: bool = True, **kwargs)
Bases: AsyncClient
Session 类,用于管理 QQ 音乐的登录态和 API 请求
PARAMETER | DESCRIPTION |
---|---|
credential
|
全局凭证,每个请求都将使用.
TYPE:
|
enable_sign
|
是否启用加密接口
TYPE:
|
enable_cache
|
是否启用请求缓存
TYPE:
|
cache_ttl
|
缓存过期时间
TYPE:
|
Source code in qqmusic_api/utils/session.py
get_session
get_session() -> Session
set_session
set_session(session: Session) -> None