mirror of
https://github.com/hanxi/xiaomusic.git
synced 2026-04-15 21:03:55 +08:00
修复报错
This commit is contained in:
@@ -15,6 +15,7 @@ from miservice import MiAccount, MiIOService, MiNAService
|
||||
from xiaomusic.config import Device
|
||||
from xiaomusic.const import COOKIE_TEMPLATE
|
||||
from xiaomusic.utils.system_utils import (
|
||||
get_random,
|
||||
parse_cookie_string,
|
||||
parse_cookie_string_to_dict,
|
||||
)
|
||||
@@ -152,19 +153,16 @@ class AuthManager:
|
||||
except Exception as e:
|
||||
self.log.warning(f"可能登录失败. {e}")
|
||||
return {}
|
||||
|
||||
|
||||
def set_token(self, account):
|
||||
"""
|
||||
设置token到account
|
||||
"""
|
||||
cookie_string = self.config.cookie
|
||||
cookie = SimpleCookie()
|
||||
cookie.load(cookie_string)
|
||||
cookies_dict = {k: m.value for k, m in cookie.items()}
|
||||
cookies_dict = parse_cookie_string_to_dict(self.config.cookie)
|
||||
account.token["passToken"] = cookies_dict["passToken"]
|
||||
account.token["userId"] = self.config.account
|
||||
account.token["deviceId"] = get_random(16).upper()
|
||||
|
||||
|
||||
def save_token(self, cookie_str):
|
||||
"""保存token到文件
|
||||
|
||||
|
||||
Reference in New Issue
Block a user