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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: neris_api_client
3
- Version: 1.5.1
3
+ Version: 1.5.2
4
4
  Summary: NERIS API Client
5
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "neris_api_client"
7
- version = "1.5.1"
7
+ version = "1.5.2"
8
8
  authors = [
9
9
  { name="Ben Coleman", email="ben.coleman@ul.org" },
10
10
  { name="Joseph Pagani", email="joseph.pagani@ul.org"}
@@ -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: