utils.credential
凭据类,用于请求验证
Credential
dataclass
Credential(openid: str = '', refresh_token: str = '', access_token: str = '', expired_at: int = 0, musicid: int = 0, musickey: str = '', unionid: str = '', str_musicid: str = '', refresh_key: str = '', encrypt_uin: str = '', login_type: int = 0, extra_fields: dict[str, Any] = dict())
凭据类
ATTRIBUTE | DESCRIPTION |
---|---|
openid |
OpenID
TYPE:
|
refresh_token |
RefreshToken
TYPE:
|
access_token |
AccessToken
TYPE:
|
expired_at |
到期时间
TYPE:
|
musicid |
QQMusicID
TYPE:
|
musickey |
QQMusicKey
TYPE:
|
unionid |
UnionID
TYPE:
|
str_musicid |
QQMusicID
TYPE:
|
refresh_key |
RefreshKey
TYPE:
|
login_type |
登录类型
TYPE:
|
extra_fields |
额外字段 |
has_musicid
has_musicid() -> bool
has_musickey
has_musickey() -> bool
raise_for_invalid
检查凭据是否有效
RAISES | DESCRIPTION |
---|---|
CredentialInvalidError
|
没有提供 musicid 或 musickey |
Source code in qqmusic_api/utils/credential.py
is_expired
async
is_expired() -> bool
as_dict
as_dict() -> dict
as_json
as_json() -> str
from_cookies_dict
classmethod
从 cookies 字典创建 Credential 实例
PARAMETER | DESCRIPTION |
---|---|
cookies
|
Cookies 字典 |
RETURNS | DESCRIPTION |
---|---|
Self
|
凭据类实例 |