Bases: BaseRestHttpConnector
Source code in django_spire/metric/domain/statistic/services/rest_connector.py
| def __init__(self, base_url: str, api_key: str) -> None:
self.base_url = base_url
self.base_headers = {'X-API-Key': api_key, 'Content-Type': 'application/json'}
super().__init__()
|
max_retries = 2
class-attribute
instance-attribute
timeout = 10
class-attribute
instance-attribute
base_url = base_url
class-attribute
instance-attribute
base_headers = {'X-API-Key': api_key, 'Content-Type': 'application/json'}
instance-attribute
record
Source code in django_spire/metric/domain/statistic/services/rest_connector.py
| def record(self, statistic_key: str, payload: dict) -> dict | None:
return self.post(f'{_REMOTE_API_PATH}/{statistic_key}/record', json=payload).json()
|