feat: add nowcast point alarm page client with SQLite store
Adds point_alarm.py (flattening, secret masking, SQLite upsert store, paged fetch with 403 fallback, CSV/TXT export, shared filter loader), nowcast-point-page.py CLI and unit tests. Register will read the shared filter from nowcast-point-alarm-filter.json instead of repeating it in the CSV.
This commit is contained in:
+12
-1
@@ -12,7 +12,7 @@ from typing import Any
|
||||
from urllib.parse import urlsplit
|
||||
from uuid import UUID
|
||||
|
||||
from common import ConfigurationError
|
||||
from common import ApiError, ConfigurationError, IklimClient
|
||||
|
||||
|
||||
AUTHENTICATION_FIELDS = {
|
||||
@@ -154,3 +154,14 @@ def write_csv_atomic(
|
||||
finally:
|
||||
if temp_path and temp_path.exists():
|
||||
temp_path.unlink()
|
||||
|
||||
|
||||
def fetch_account_id(client: IklimClient) -> str:
|
||||
"""Return the caller's account id from /v1/users/me."""
|
||||
response = client.request_json("GET", "/v1/users/me")
|
||||
data = response.data
|
||||
account = data.get("account") if isinstance(data, dict) else None
|
||||
account_id = account.get("id") if isinstance(account, dict) else None
|
||||
if not as_uuid(account_id):
|
||||
raise ApiError("/v1/users/me yanıtında geçerli account.id bulunamadı.")
|
||||
return account_id
|
||||
|
||||
Reference in New Issue
Block a user