This commit is contained in:
shaonianzhentan 2023-02-22 14:00:11 +08:00
parent 11568ef46e
commit a4e4a09fd3
1 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,4 @@
from unittest import result
import uuid, time, json, os, hashlib, aiohttp
import uuid, time, logging, os, hashlib, aiohttp
from urllib.parse import quote
from homeassistant.helpers.network import get_url
from .http_api import http_get, http_cookie
@ -17,6 +16,8 @@ from .browse_media import (
def md5(data):
return hashlib.md5(data.encode('utf-8')).hexdigest()
_LOGGER = logging.getLogger(__name__)
class CloudMusic():
def __init__(self, hass, url) -> None:
@ -50,6 +51,7 @@ class CloudMusic():
login_url = login_url + '/cellphone?phone='
data = await http_cookie(login_url + f'{quote(username)}&password={quote(password)}&md5_password={md5(password)}')
_LOGGER.debug(data)
res_data = data.get('data', {})
# 登录成功
if res_data.get('code') == 200: