1
0
Fork 0
mirror of https://github.com/Andre0512/pyhOn.git synced 2025-06-02 07:39:51 -04:00

Set refresh token

This commit is contained in:
Andre Basche 2024-02-10 00:59:14 +01:00
parent df27729c2e
commit 767cbe35de
4 changed files with 24 additions and 3 deletions
pyhon/connection/handler

View file

@ -23,12 +23,14 @@ class HonConnectionHandler(ConnectionHandler):
email: str,
password: str,
mobile_id: str = "",
refresh_token: str = "",
session: Optional[aiohttp.ClientSession] = None,
) -> None:
super().__init__(session=session)
self._device: HonDevice = HonDevice(mobile_id)
self._email: str = email
self._password: str = password
self._refresh_token: str = refresh_token
if not self._email:
raise HonAuthenticationError("An email address must be specified")
if not self._password:
@ -47,7 +49,13 @@ class HonConnectionHandler(ConnectionHandler):
async def create(self) -> Self:
await super().create()
self._auth = HonAuth(self.session, self._email, self._password, self._device)
self._auth = HonAuth(
self.session,
self._email,
self._password,
self._device,
refresh_token=self._refresh_token,
)
return self
async def _check_headers(self, headers: Dict[str, str]) -> Dict[str, str]: