mirror of
https://github.com/Andre0512/pyhOn.git
synced 2024-12-22 10:45:31 +00:00
Change mobile id
This commit is contained in:
parent
a5595f47bf
commit
df27729c2e
|
@ -24,12 +24,14 @@ class HonAPI:
|
||||||
email: str = "",
|
email: str = "",
|
||||||
password: str = "",
|
password: str = "",
|
||||||
anonymous: bool = False,
|
anonymous: bool = False,
|
||||||
|
mobile_id: str = "",
|
||||||
session: Optional[ClientSession] = None,
|
session: Optional[ClientSession] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._email: str = email
|
self._email: str = email
|
||||||
self._password: str = password
|
self._password: str = password
|
||||||
self._anonymous: bool = anonymous
|
self._anonymous: bool = anonymous
|
||||||
|
self._mobile_id: str = mobile_id
|
||||||
self._hon_handler: Optional[HonConnectionHandler] = None
|
self._hon_handler: Optional[HonConnectionHandler] = None
|
||||||
self._hon_anonymous_handler: Optional[HonAnonymousConnectionHandler] = None
|
self._hon_anonymous_handler: Optional[HonAnonymousConnectionHandler] = None
|
||||||
self._session: Optional[ClientSession] = session
|
self._session: Optional[ClientSession] = session
|
||||||
|
@ -69,7 +71,7 @@ class HonAPI:
|
||||||
).create()
|
).create()
|
||||||
if not self._anonymous:
|
if not self._anonymous:
|
||||||
self._hon_handler = await HonConnectionHandler(
|
self._hon_handler = await HonConnectionHandler(
|
||||||
self._email, self._password, self._session
|
self._email, self._password, self._session, mobile_id=self._mobile_id
|
||||||
).create()
|
).create()
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
import secrets
|
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
from pyhon import const
|
from pyhon import const
|
||||||
|
|
||||||
|
|
||||||
class HonDevice:
|
class HonDevice:
|
||||||
def __init__(self) -> None:
|
def __init__(self, mobile_id: str = "") -> None:
|
||||||
self._app_version: str = const.APP_VERSION
|
self._app_version: str = const.APP_VERSION
|
||||||
self._os_version: int = const.OS_VERSION
|
self._os_version: int = const.OS_VERSION
|
||||||
self._os: str = const.OS
|
self._os: str = const.OS
|
||||||
self._device_model: str = const.DEVICE_MODEL
|
self._device_model: str = const.DEVICE_MODEL
|
||||||
self._mobile_id: str = secrets.token_hex(8)
|
self._mobile_id: str = mobile_id or const.MOBILE_ID
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def app_version(self) -> str:
|
def app_version(self) -> str:
|
||||||
|
|
|
@ -19,10 +19,14 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
class HonConnectionHandler(ConnectionHandler):
|
class HonConnectionHandler(ConnectionHandler):
|
||||||
def __init__(
|
def __init__(
|
||||||
self, email: str, password: str, session: Optional[aiohttp.ClientSession] = None
|
self,
|
||||||
|
email: str,
|
||||||
|
password: str,
|
||||||
|
mobile_id: str = "",
|
||||||
|
session: Optional[aiohttp.ClientSession] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
super().__init__(session=session)
|
super().__init__(session=session)
|
||||||
self._device: HonDevice = HonDevice()
|
self._device: HonDevice = HonDevice(mobile_id)
|
||||||
self._email: str = email
|
self._email: str = email
|
||||||
self._password: str = password
|
self._password: str = password
|
||||||
if not self._email:
|
if not self._email:
|
||||||
|
|
|
@ -6,8 +6,9 @@ CLIENT_ID = (
|
||||||
"3MVG9QDx8IX8nP5T2Ha8ofvlmjLZl5L_gvfbT9."
|
"3MVG9QDx8IX8nP5T2Ha8ofvlmjLZl5L_gvfbT9."
|
||||||
"HJvpHGKoAS_dcMN8LYpTSYeVFCraUnV.2Ag1Ki7m4znVO6"
|
"HJvpHGKoAS_dcMN8LYpTSYeVFCraUnV.2Ag1Ki7m4znVO6"
|
||||||
)
|
)
|
||||||
APP_VERSION = "2.4.7"
|
APP_VERSION = "2.6.5"
|
||||||
OS_VERSION = 31
|
OS_VERSION = 999
|
||||||
OS = "android"
|
OS = "android"
|
||||||
DEVICE_MODEL = "exynos9820"
|
DEVICE_MODEL = "pyhOn"
|
||||||
USER_AGENT = "Chrome/110.0.5481.153"
|
USER_AGENT = "Chrome/999.999.999.999"
|
||||||
|
MOBILE_ID = "pyhOn"
|
||||||
|
|
|
@ -21,6 +21,7 @@ class Hon:
|
||||||
email: Optional[str] = "",
|
email: Optional[str] = "",
|
||||||
password: Optional[str] = "",
|
password: Optional[str] = "",
|
||||||
session: Optional[ClientSession] = None,
|
session: Optional[ClientSession] = None,
|
||||||
|
mobile_id: str = "",
|
||||||
test_data_path: Optional[Path] = None,
|
test_data_path: Optional[Path] = None,
|
||||||
):
|
):
|
||||||
self._email: Optional[str] = email
|
self._email: Optional[str] = email
|
||||||
|
@ -29,6 +30,7 @@ class Hon:
|
||||||
self._appliances: List[HonAppliance] = []
|
self._appliances: List[HonAppliance] = []
|
||||||
self._api: Optional[HonAPI] = None
|
self._api: Optional[HonAPI] = None
|
||||||
self._test_data_path: Path = test_data_path or Path().cwd()
|
self._test_data_path: Path = test_data_path or Path().cwd()
|
||||||
|
self._mobile_id: str = mobile_id
|
||||||
|
|
||||||
async def __aenter__(self) -> Self:
|
async def __aenter__(self) -> Self:
|
||||||
return await self.create()
|
return await self.create()
|
||||||
|
|
Loading…
Reference in a new issue