Async Log
The async Log module provides functionality for working with logs.
- class AsyncLog(api, log_id, data={})[source]
Bases:
AsyncBase- Parameters:
api (AsyncGeoboxClient)
log_id (int)
data (Dict | None)
- BASE_ENDPOINT = 'logs/'
- __init__(api, log_id, data={})[source]
Constructs all the necessary attributes for the Log object.
- Parameters:
api (AsyncGeoboxClient) – The AsyncGeoboxClient instance for making requests.
log_id (int) – The id of the log.
data (Dict, optional) – The data of the log.
- __repr__()[source]
Return a string representation of the Log object.
- Returns:
A string representation of the Log object.
- Return type:
str
- async classmethod get_logs(api, **kwargs)[source]
[async] Get a list of Logs
- Parameters:
api (AsyncGeoboxClient) – The AsyncGeoboxClient instance for making requests.
- Keyword Arguments:
search (str) – search term for keyword-based searching among all textual fields
order_by (str) – comma separated list of fields for sorting results [field1 A|D, field2 A|D, …]. e.g. name A, type D. NOTE: “A” denotes ascending order and “D” denotes descending order.
skip (int) – Number of items to skip. default is 0.
limit (int) – Number of items to return. default is 10.
user_id (int) – Specific user. Privileges required.
from_date (datetime) – datetime object in this format: “%Y-%m-%dT%H:%M:%S.%f”.
to_date (datetime) – datetime object in this format: “%Y-%m-%dT%H:%M:%S.%f”.
user_identity (str) – the user identity in this format: username - firstname lastname - email .
activity_type (str) – the user activity type.
- Returns:
a list of logs
- Return type:
List[AsyncLog]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> from geopox.aio.log import AsyncLog >>> async with AsyncGeoboxClient() as client: >>> logs = await AsyncLog.get_logs(client) or >>> logs = await client.get_logs()
- async delete()[source]
[async] Delete a log (privileges required)
- Returns:
None
- Return type:
None
Example
>>> from geobox.aio import AsyncGeoboxClient >>> from geopox.aio.log import AsyncLog >>> async with AsyncGeoboxClient() as client: >>> log = await AsyncLog.get_logs(client)[0] >>> await log.delete()
- property user: AsyncUser | None
[async] Get the owner user for the log
- Returns:
if the log has owner user
- Return type:
User | None
Example
>>> from geobox.aio import AsyncGeoboxClient >>> from geopox.aio.log import AsyncLog >>> async with AsyncGeoboxClient() as client: >>> log = await AsyncLog.get_logs(client)[0] >>> await log.user