neris-api-client 1.5.0__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.
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: neris_api_client
3
- Version: 1.5.0
3
+ Version: 1.5.2
4
4
  Summary: NERIS API Client
5
- Author-email: Ben Coleman <ben.coleman@ul.org>, Tommy Messbauer <thomas.messbauer@ul.org>, Joseph Pagani <joseph.pagani@ul.org>
5
+ Author-email: Ben Coleman <ben.coleman@ul.org>, Joseph Pagani <joseph.pagani@ul.org>
6
6
  Project-URL: Homepage, https://github.com/ulfsri/neris-api-client
7
7
  Project-URL: Issues, https://neris.atlassian.net/servicedesk/customer/portal/3/group/3/create/10027
8
8
  Classifier: Programming Language :: Python :: 3
@@ -4,10 +4,9 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "neris_api_client"
7
- version = "1.5.0"
7
+ version = "1.5.2"
8
8
  authors = [
9
9
  { name="Ben Coleman", email="ben.coleman@ul.org" },
10
- { name="Tommy Messbauer", email="thomas.messbauer@ul.org" },
11
10
  { name="Joseph Pagani", email="joseph.pagani@ul.org"}
12
11
  ]
13
12
  description = "NERIS API Client"
@@ -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
@@ -329,7 +331,9 @@ class NerisApiClient(_NerisApiClient):
329
331
  incident_number: str | None = None,
330
332
  dispatch_incident_number: str | None = None,
331
333
  status: list[Literal["APPROVED", "PENDING_APPROVAL", "REJECTED", "SUBMITTED"]] | None = None,
334
+ state: str | None = None,
332
335
  last_modified: str | None = None,
336
+ geo_format: Literal["url", "geojson"] | None = None,
333
337
  sort_by: Literal["call_create", "neris_id_entity", "incident_number", "dispatch_incident_number", "status", "last_modified"] | None = None,
334
338
  sort_direction: Literal["ASCENDING", "DESCENDING"] | None = None,
335
339
  page_size: int | None = None,
@@ -344,7 +348,9 @@ class NerisApiClient(_NerisApiClient):
344
348
  incident_number=incident_number,
345
349
  dispatch_incident_number=dispatch_incident_number,
346
350
  status=status,
351
+ state=state,
347
352
  last_modified=last_modified,
353
+ geo_format=geo_format,
348
354
  sort_by=sort_by,
349
355
  sort_direction=sort_direction,
350
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: