neris-api-client 1.5.1__tar.gz → 1.5.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {neris_api_client-1.5.1/src/neris_api_client.egg-info → neris_api_client-1.5.2}/PKG-INFO +1 -1
- {neris_api_client-1.5.1 → neris_api_client-1.5.2}/pyproject.toml +1 -1
- {neris_api_client-1.5.1 → neris_api_client-1.5.2}/src/neris_api_client/client.py +4 -0
- {neris_api_client-1.5.1 → neris_api_client-1.5.2}/src/neris_api_client/config.py +4 -0
- neris_api_client-1.5.2/src/neris_api_client/models.py +13577 -0
- {neris_api_client-1.5.1 → neris_api_client-1.5.2/src/neris_api_client.egg-info}/PKG-INFO +1 -1
- neris_api_client-1.5.1/src/neris_api_client/models.py +0 -11952
- {neris_api_client-1.5.1 → neris_api_client-1.5.2}/LICENSE +0 -0
- {neris_api_client-1.5.1 → neris_api_client-1.5.2}/README.md +0 -0
- {neris_api_client-1.5.1 → neris_api_client-1.5.2}/setup.cfg +0 -0
- {neris_api_client-1.5.1 → neris_api_client-1.5.2}/src/neris_api_client/__init__.py +0 -0
- {neris_api_client-1.5.1 → neris_api_client-1.5.2}/src/neris_api_client.egg-info/SOURCES.txt +0 -0
- {neris_api_client-1.5.1 → neris_api_client-1.5.2}/src/neris_api_client.egg-info/dependency_links.txt +0 -0
- {neris_api_client-1.5.1 → neris_api_client-1.5.2}/src/neris_api_client.egg-info/requires.txt +0 -0
- {neris_api_client-1.5.1 → neris_api_client-1.5.2}/src/neris_api_client.egg-info/top_level.txt +0 -0
|
@@ -49,6 +49,8 @@ class _NerisApiClient:
|
|
|
49
49
|
if config is None:
|
|
50
50
|
config = Config() # by default it loads from env
|
|
51
51
|
|
|
52
|
+
self._session.headers.update({"User-Agent": config.user_agent})
|
|
53
|
+
|
|
52
54
|
match config.grant_type:
|
|
53
55
|
case GrantType.CLIENT_CREDENTIALS:
|
|
54
56
|
assert config.client_id is not None
|
|
@@ -331,6 +333,7 @@ class NerisApiClient(_NerisApiClient):
|
|
|
331
333
|
status: list[Literal["APPROVED", "PENDING_APPROVAL", "REJECTED", "SUBMITTED"]] | None = None,
|
|
332
334
|
state: str | None = None,
|
|
333
335
|
last_modified: str | None = None,
|
|
336
|
+
geo_format: Literal["url", "geojson"] | None = None,
|
|
334
337
|
sort_by: Literal["call_create", "neris_id_entity", "incident_number", "dispatch_incident_number", "status", "last_modified"] | None = None,
|
|
335
338
|
sort_direction: Literal["ASCENDING", "DESCENDING"] | None = None,
|
|
336
339
|
page_size: int | None = None,
|
|
@@ -347,6 +350,7 @@ class NerisApiClient(_NerisApiClient):
|
|
|
347
350
|
status=status,
|
|
348
351
|
state=state,
|
|
349
352
|
last_modified=last_modified,
|
|
353
|
+
geo_format=geo_format,
|
|
350
354
|
sort_by=sort_by,
|
|
351
355
|
sort_direction=sort_direction,
|
|
352
356
|
page_size=page_size,
|
|
@@ -3,6 +3,8 @@ from datetime import datetime
|
|
|
3
3
|
from enum import Enum
|
|
4
4
|
import os
|
|
5
5
|
|
|
6
|
+
DEFAULT_USER_AGENT: str = "NerisApiClient/1.5.2"
|
|
7
|
+
|
|
6
8
|
class GrantType(str, Enum):
|
|
7
9
|
CLIENT_CREDENTIALS = "client_credentials"
|
|
8
10
|
PASSWORD = "password"
|
|
@@ -17,12 +19,14 @@ class Config:
|
|
|
17
19
|
client_secret: str | None = None
|
|
18
20
|
grant_type: GrantType | None = None
|
|
19
21
|
validate: bool | None = None
|
|
22
|
+
user_agent: str = DEFAULT_USER_AGENT
|
|
20
23
|
|
|
21
24
|
def __post_init__(self):
|
|
22
25
|
# env var handling
|
|
23
26
|
self.base_url = self.base_url or os.getenv("NERIS_BASE_URL")
|
|
24
27
|
self.debug = self.debug if self.debug is not None else os.getenv("NERIS_DEBUG") == "true"
|
|
25
28
|
self.validate = self.validate if self.validate is not None else os.getenv("NERIS_VALIDATE") == "true"
|
|
29
|
+
self.user_agent = self.user_agent and os.getenv("NERIS_USER_AGENT", DEFAULT_USER_AGENT)
|
|
26
30
|
|
|
27
31
|
match os.getenv("NERIS_GRANT_TYPE"):
|
|
28
32
|
case GrantType.PASSWORD:
|