Change mobile id

This commit is contained in:
Andre Basche 2024-02-09 20:37:53 +01:00
parent a5595f47bf
commit df27729c2e
5 changed files with 18 additions and 10 deletions

View file

@ -24,12 +24,14 @@ class HonAPI:
email: str = "",
password: str = "",
anonymous: bool = False,
mobile_id: str = "",
session: Optional[ClientSession] = None,
) -> None:
super().__init__()
self._email: str = email
self._password: str = password
self._anonymous: bool = anonymous
self._mobile_id: str = mobile_id
self._hon_handler: Optional[HonConnectionHandler] = None
self._hon_anonymous_handler: Optional[HonAnonymousConnectionHandler] = None
self._session: Optional[ClientSession] = session
@ -69,7 +71,7 @@ class HonAPI:
).create()
if not self._anonymous:
self._hon_handler = await HonConnectionHandler(
self._email, self._password, self._session
self._email, self._password, self._session, mobile_id=self._mobile_id
).create()
return self

View file

@ -1,16 +1,15 @@
import secrets
from typing import Dict
from pyhon import const
class HonDevice:
def __init__(self) -> None:
def __init__(self, mobile_id: str = "") -> None:
self._app_version: str = const.APP_VERSION
self._os_version: int = const.OS_VERSION
self._os: str = const.OS
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
def app_version(self) -> str:

View file

@ -19,10 +19,14 @@ _LOGGER = logging.getLogger(__name__)
class HonConnectionHandler(ConnectionHandler):
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:
super().__init__(session=session)
self._device: HonDevice = HonDevice()
self._device: HonDevice = HonDevice(mobile_id)
self._email: str = email
self._password: str = password
if not self._email: