divera.client package
Module contents
- class divera.client.Client(config_folder: str = None, use_recommended_callbacks: bool = True)[source]
Bases:
object- add_callback(callback: ~typing.Callable, filter_: [typing.Type[divera.triggers.Trigger], typing.Callable, <class 'Exception'>], model: [typing.Type[divera.models.Model], typing.List[typing.Type[divera.models.Model]]] = None)[source]
Add callbacks and rules on when and for which model they are to be called.
- Parameters:
callback – The function to be called.
filter – The class of the trigger or a function that returns True if the function is to be called.
model – The type of object this callback should be used with. Use None for any model, or a list of models for any model in that list.
- Returns:
None
- async get_jwt(version: str = '')[source]
Get a new jason web token
- Parameters:
version – If you add any of [‘ws’, ‘api’] to get the respective jwt
- Returns:
jason web token as string
- async login(username, password, domain: str = None, url_websocket: str = None)[source]
Log in to an account.
- Parameters:
username – email address of the user
password – password if the user
domain – domain of the server (needed if not set in config yet)
url_websocket – url of the websocket of the server for real time updated
- Returns:
- async login_with_access_token(username: str, access_token: str, domain: str)[source]
If the user should not be asked for a password, they can be asked for their access_token instead. This is also referred to as ‘access key’ and can be found in the DEBUG section of your account settings.
- Parameters:
username – Your username (email)
access_token – The access token / access key from the DEBUG section of your account settings.
domain – The domain of your divera instance
- async poll_once(models: [List[Type[divera.models.Model]], Tuple[Type[divera.models.Model]]] = None)[source]
- read_config()[source]
Load the configuration data from the divera.json inside the folder specified on __init__. The configuration also gets updated to the latest version.
- async request(endpoint: [<class 'divera.api.endpointwrappers.EndPoint'>, typing.AsyncGenerator, typing.Generator, typing.Any]) Any[source]
- async set_status(status: [<class 'int'>, <class 'divera.models.status.Status'>] = None, note: str = None, vehicle: int = None, reset_date: [<class 'int'>, <class 'datetime.datetime'>] = None, reset_to: int = None, alarm_skip: bool = None, status_skip_statusplan: bool = None, status_skip_geofence: bool = None)[source]