mirror of
https://github.com/no2chem/wideq.git
synced 2025-05-29 13:30:26 -07:00
Allow country and language arguments to from_token
Useful for the Home Assistant component.
This commit is contained in:
parent
a16e146b64
commit
fd68455910
9
wideq.py
9
wideq.py
@ -11,7 +11,7 @@ import datetime
|
|||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
import enum
|
import enum
|
||||||
|
|
||||||
__version__ = '1.0.0'
|
__version__ = '1.0.1'
|
||||||
|
|
||||||
GATEWAY_URL = 'https://kic.lgthinq.com:46030/api/common/gatewayUriList'
|
GATEWAY_URL = 'https://kic.lgthinq.com:46030/api/common/gatewayUriList'
|
||||||
APP_KEY = 'wideq'
|
APP_KEY = 'wideq'
|
||||||
@ -585,7 +585,7 @@ class Client(object):
|
|||||||
self._session, self._devices = self.auth.start_session()
|
self._session, self._devices = self.auth.start_session()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_token(cls, refresh_token):
|
def from_token(cls, refresh_token, country=None, language=None):
|
||||||
"""Construct a client using just a refresh token.
|
"""Construct a client using just a refresh token.
|
||||||
|
|
||||||
This allows simpler state storage (e.g., for human-written
|
This allows simpler state storage (e.g., for human-written
|
||||||
@ -593,7 +593,10 @@ class Client(object):
|
|||||||
to reload the gateway servers and restart the session.
|
to reload the gateway servers and restart the session.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
client = cls()
|
client = cls(
|
||||||
|
country=country or DEFAULT_COUNTRY,
|
||||||
|
language=language or DEFAULT_LANGUAGE,
|
||||||
|
)
|
||||||
client._auth = Auth(client.gateway, None, refresh_token)
|
client._auth = Auth(client.gateway, None, refresh_token)
|
||||||
client.refresh()
|
client.refresh()
|
||||||
return client
|
return client
|
||||||
|
Loading…
x
Reference in New Issue
Block a user