neris-api-client 1.2.0rc2__tar.gz → 1.3.0__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.
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.2
2
+ Name: neris_api_client
3
+ Version: 1.3.0
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>
6
+ Project-URL: Homepage, https://github.com/ulfsri/neris-api-client
7
+ Project-URL: Issues, https://neris.atlassian.net/servicedesk/customer/portal/3/group/3/create/10027
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: requests
15
+ Requires-Dist: pydantic[email]>=2
16
+ Requires-Dist: python-dotenv
17
+
18
+ # NERIS API Client
19
+
20
+ A Python class to interact with the NERIS API programmatically.
21
+
22
+ > **NOTE:** Due to the changes and transition to using Oauth 2.0 version 1.2 is now deprecated. Please upgrade to version 1.3. You can do that in a package manager with the following update: `neris-api-client = ">=1.3"` or in your `requirements.txt` you can do `neris-api-client >=1.3`. Or you can install with `pip install neris_api_client>=1.3.`.
23
+
24
+ ## Versioning
25
+
26
+ This API client does not directly follow semver practices. In order to remove confusion between the NERIS API client and API, we have decided to align the major version of this client with the major version of the API release. The minor and patch versions of this client will differ from API release version, they will instead represent changes made to the API client itself.
27
+
28
+ ## Installation
29
+
30
+ To install:
31
+ ```bash
32
+ pip install neris-api-client
33
+ ```
34
+ Package published on PyPi: [`NERIS API Client`](https://pypi.org/project/neris-api-client/)
35
+
36
+ ## Usage
37
+
38
+ **Auth with password `auth` flow**
39
+
40
+ All config parameters can be specified as environment variables prefixed with `NERIS_` e.g. `NERIS_GRANT_TYPE=password`.
41
+ ```python
42
+ from neris_api_client import NerisApiClient, Config
43
+
44
+ client = NerisApiClient(
45
+ Config(
46
+ base_url="https://api-test.neris.fsri.org/v1",
47
+ grant_type="password",
48
+ username="neris.user@email.co",
49
+ password="*******",
50
+ )
51
+ )
52
+
53
+ # Get an entity
54
+ entity = client.get_entity("FD24027240")
55
+
56
+ # If MFA enabled, prompt for auth challenge answer
57
+ Provide MFA code for email_otp: ******
58
+ ```
59
+
60
+ **Auth with `client_credentials` auth flow**
61
+
62
+ All config parameters can be specified as environment variables prefixed with `NERIS_` e.g. `NERIS_GRANT_TYPE=client_credentials`.
63
+ ```python
64
+ from neris_api_client import NerisApiClient, Config
65
+
66
+ client = NerisApiClient(
67
+ Config(
68
+ base_url="https://api-test.neris.fsri.org/v1",
69
+ grant_type="client_credentials",
70
+ client_id="********************",
71
+ client_secret="***************",
72
+ )
73
+ )
74
+
75
+ # Get an entity
76
+ entity = client.get_entity("FD24027240")
77
+ ```
78
+
79
+ **Using environment varables to instantiate the library**
80
+
81
+ [Configuration should be stored in the environment](https://12factor.net/config). The following uses `dotenv` to load the configuration, but you can use whatever you like. In the cloud, you might load all of these values into the environment from an encrypted parameter store.
82
+
83
+ All variables prefixed are prefixed with `NERIS_`
84
+
85
+ * See [env.example](./examples/.env.example) for the parameter options.
86
+ * Store the `/env` file in the current working directory.
87
+
88
+ ```python
89
+ from dotenv import load_dotenv
90
+ from neris_api_client import NerisApiClient, Config
91
+
92
+ # Credentials must be defined in .env
93
+ load_dotenv()
94
+ client = NerisApiClient()
95
+
96
+ # Get an entity
97
+ entity = client.get_entity("FD24027240")
98
+ ```
99
+
100
+ ## Disclaimer
101
+ The models in this package are generated using [`datamodel-code-generator`](https://github.com/koxudaxi/datamodel-code-generator) and are not guaranteed
102
+ to contain all of the information present in the full specification. The generated models are used to validate request payloads prior to
103
+ API submission.
104
+
105
+ ## Additional Information
106
+ To ask a question, make a suggestion, or otherwise get help with the NERIS API Client, please visit [the NERIS helpdesk](https://neris.atlassian.net/servicedesk/customer/portals).
107
+
108
+ **Beta sandbox users**:
109
+ - Be sure to use the base URL `https://api-test.neris.fsri.org/v1` with the NERIS API Client. You will not be able to authenticate requests in the other environments.
110
+ - For the beta testing period, your user is only authorized to perform actions on behalf of the FSRI Fire Department `FD24027214`.
@@ -0,0 +1,93 @@
1
+ # NERIS API Client
2
+
3
+ A Python class to interact with the NERIS API programmatically.
4
+
5
+ > **NOTE:** Due to the changes and transition to using Oauth 2.0 version 1.2 is now deprecated. Please upgrade to version 1.3. You can do that in a package manager with the following update: `neris-api-client = ">=1.3"` or in your `requirements.txt` you can do `neris-api-client >=1.3`. Or you can install with `pip install neris_api_client>=1.3.`.
6
+
7
+ ## Versioning
8
+
9
+ This API client does not directly follow semver practices. In order to remove confusion between the NERIS API client and API, we have decided to align the major version of this client with the major version of the API release. The minor and patch versions of this client will differ from API release version, they will instead represent changes made to the API client itself.
10
+
11
+ ## Installation
12
+
13
+ To install:
14
+ ```bash
15
+ pip install neris-api-client
16
+ ```
17
+ Package published on PyPi: [`NERIS API Client`](https://pypi.org/project/neris-api-client/)
18
+
19
+ ## Usage
20
+
21
+ **Auth with password `auth` flow**
22
+
23
+ All config parameters can be specified as environment variables prefixed with `NERIS_` e.g. `NERIS_GRANT_TYPE=password`.
24
+ ```python
25
+ from neris_api_client import NerisApiClient, Config
26
+
27
+ client = NerisApiClient(
28
+ Config(
29
+ base_url="https://api-test.neris.fsri.org/v1",
30
+ grant_type="password",
31
+ username="neris.user@email.co",
32
+ password="*******",
33
+ )
34
+ )
35
+
36
+ # Get an entity
37
+ entity = client.get_entity("FD24027240")
38
+
39
+ # If MFA enabled, prompt for auth challenge answer
40
+ Provide MFA code for email_otp: ******
41
+ ```
42
+
43
+ **Auth with `client_credentials` auth flow**
44
+
45
+ All config parameters can be specified as environment variables prefixed with `NERIS_` e.g. `NERIS_GRANT_TYPE=client_credentials`.
46
+ ```python
47
+ from neris_api_client import NerisApiClient, Config
48
+
49
+ client = NerisApiClient(
50
+ Config(
51
+ base_url="https://api-test.neris.fsri.org/v1",
52
+ grant_type="client_credentials",
53
+ client_id="********************",
54
+ client_secret="***************",
55
+ )
56
+ )
57
+
58
+ # Get an entity
59
+ entity = client.get_entity("FD24027240")
60
+ ```
61
+
62
+ **Using environment varables to instantiate the library**
63
+
64
+ [Configuration should be stored in the environment](https://12factor.net/config). The following uses `dotenv` to load the configuration, but you can use whatever you like. In the cloud, you might load all of these values into the environment from an encrypted parameter store.
65
+
66
+ All variables prefixed are prefixed with `NERIS_`
67
+
68
+ * See [env.example](./examples/.env.example) for the parameter options.
69
+ * Store the `/env` file in the current working directory.
70
+
71
+ ```python
72
+ from dotenv import load_dotenv
73
+ from neris_api_client import NerisApiClient, Config
74
+
75
+ # Credentials must be defined in .env
76
+ load_dotenv()
77
+ client = NerisApiClient()
78
+
79
+ # Get an entity
80
+ entity = client.get_entity("FD24027240")
81
+ ```
82
+
83
+ ## Disclaimer
84
+ The models in this package are generated using [`datamodel-code-generator`](https://github.com/koxudaxi/datamodel-code-generator) and are not guaranteed
85
+ to contain all of the information present in the full specification. The generated models are used to validate request payloads prior to
86
+ API submission.
87
+
88
+ ## Additional Information
89
+ To ask a question, make a suggestion, or otherwise get help with the NERIS API Client, please visit [the NERIS helpdesk](https://neris.atlassian.net/servicedesk/customer/portals).
90
+
91
+ **Beta sandbox users**:
92
+ - Be sure to use the base URL `https://api-test.neris.fsri.org/v1` with the NERIS API Client. You will not be able to authenticate requests in the other environments.
93
+ - For the beta testing period, your user is only authorized to perform actions on behalf of the FSRI Fire Department `FD24027214`.
@@ -4,10 +4,11 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "neris_api_client"
7
- version = "1.2.0rc2"
7
+ version = "1.3.0"
8
8
  authors = [
9
9
  { name="Ben Coleman", email="ben.coleman@ul.org" },
10
10
  { name="Tommy Messbauer", email="thomas.messbauer@ul.org" },
11
+ { name="Joseph Pagani", email="joseph.pagani@ul.org"}
11
12
  ]
12
13
  description = "NERIS API Client"
13
14
  readme = "README.md"
@@ -64,8 +64,8 @@ class _NerisApiClient:
64
64
  case GrantType.PASSWORD:
65
65
  res = self._session.post(
66
66
  token_url,
67
- headers={},
68
- json={
67
+ headers={'Content-Type': 'application/x-www-form-urlencoded'},
68
+ data={
69
69
  "grant_type": GrantType.PASSWORD,
70
70
  "username": self.config.username,
71
71
  "password": self.config.password,
@@ -77,8 +77,8 @@ class _NerisApiClient:
77
77
 
78
78
  res = self._session.post(
79
79
  token_url,
80
- headers={"Authorization": f"Basic {client_creds}"},
81
- json={"grant_type": GrantType.CLIENT_CREDENTIALS},
80
+ headers={"Authorization": f"Basic {client_creds}", 'Content-Type': 'application/x-www-form-urlencoded'},
81
+ data={"grant_type": GrantType.CLIENT_CREDENTIALS},
82
82
  )
83
83
 
84
84
  elif self.tokens.expires_at <= datetime.now():
@@ -87,8 +87,8 @@ class _NerisApiClient:
87
87
  res = self._session.post(
88
88
  token_url,
89
89
  # No basic auth needed for Cognito refresh tokens
90
- headers={},
91
- json={
90
+ headers={'Content-Type': 'application/x-www-form-urlencoded'},
91
+ data={
92
92
  "grant_type": "refresh_token",
93
93
  "refresh_token": self.tokens.refresh_token,
94
94
  },
@@ -97,8 +97,8 @@ class _NerisApiClient:
97
97
  case GrantType.CLIENT_CREDENTIALS:
98
98
  res = self._session.post(
99
99
  token_url,
100
- headers={"Authorization": f"Basic {client_creds}"},
101
- json={
100
+ headers={"Authorization": f"Basic {client_creds}", 'Content-Type': 'application/x-www-form-urlencoded'},
101
+ data={
102
102
  "grant_type": "refresh_token",
103
103
  "refresh_token": self.tokens.refresh_token,
104
104
  },
@@ -141,8 +141,8 @@ class _NerisApiClient:
141
141
 
142
142
  res = self._session.post(
143
143
  token_url,
144
- headers={},
145
- json={
144
+ headers={'Content-Type': 'application/x-www-form-urlencoded'},
145
+ data={
146
146
  "grant_type": got["challenge_name"],
147
147
  "username": self.config.username,
148
148
  "session": got["session"],
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.2
2
+ Name: neris_api_client
3
+ Version: 1.3.0
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>
6
+ Project-URL: Homepage, https://github.com/ulfsri/neris-api-client
7
+ Project-URL: Issues, https://neris.atlassian.net/servicedesk/customer/portal/3/group/3/create/10027
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: requests
15
+ Requires-Dist: pydantic[email]>=2
16
+ Requires-Dist: python-dotenv
17
+
18
+ # NERIS API Client
19
+
20
+ A Python class to interact with the NERIS API programmatically.
21
+
22
+ > **NOTE:** Due to the changes and transition to using Oauth 2.0 version 1.2 is now deprecated. Please upgrade to version 1.3. You can do that in a package manager with the following update: `neris-api-client = ">=1.3"` or in your `requirements.txt` you can do `neris-api-client >=1.3`. Or you can install with `pip install neris_api_client>=1.3.`.
23
+
24
+ ## Versioning
25
+
26
+ This API client does not directly follow semver practices. In order to remove confusion between the NERIS API client and API, we have decided to align the major version of this client with the major version of the API release. The minor and patch versions of this client will differ from API release version, they will instead represent changes made to the API client itself.
27
+
28
+ ## Installation
29
+
30
+ To install:
31
+ ```bash
32
+ pip install neris-api-client
33
+ ```
34
+ Package published on PyPi: [`NERIS API Client`](https://pypi.org/project/neris-api-client/)
35
+
36
+ ## Usage
37
+
38
+ **Auth with password `auth` flow**
39
+
40
+ All config parameters can be specified as environment variables prefixed with `NERIS_` e.g. `NERIS_GRANT_TYPE=password`.
41
+ ```python
42
+ from neris_api_client import NerisApiClient, Config
43
+
44
+ client = NerisApiClient(
45
+ Config(
46
+ base_url="https://api-test.neris.fsri.org/v1",
47
+ grant_type="password",
48
+ username="neris.user@email.co",
49
+ password="*******",
50
+ )
51
+ )
52
+
53
+ # Get an entity
54
+ entity = client.get_entity("FD24027240")
55
+
56
+ # If MFA enabled, prompt for auth challenge answer
57
+ Provide MFA code for email_otp: ******
58
+ ```
59
+
60
+ **Auth with `client_credentials` auth flow**
61
+
62
+ All config parameters can be specified as environment variables prefixed with `NERIS_` e.g. `NERIS_GRANT_TYPE=client_credentials`.
63
+ ```python
64
+ from neris_api_client import NerisApiClient, Config
65
+
66
+ client = NerisApiClient(
67
+ Config(
68
+ base_url="https://api-test.neris.fsri.org/v1",
69
+ grant_type="client_credentials",
70
+ client_id="********************",
71
+ client_secret="***************",
72
+ )
73
+ )
74
+
75
+ # Get an entity
76
+ entity = client.get_entity("FD24027240")
77
+ ```
78
+
79
+ **Using environment varables to instantiate the library**
80
+
81
+ [Configuration should be stored in the environment](https://12factor.net/config). The following uses `dotenv` to load the configuration, but you can use whatever you like. In the cloud, you might load all of these values into the environment from an encrypted parameter store.
82
+
83
+ All variables prefixed are prefixed with `NERIS_`
84
+
85
+ * See [env.example](./examples/.env.example) for the parameter options.
86
+ * Store the `/env` file in the current working directory.
87
+
88
+ ```python
89
+ from dotenv import load_dotenv
90
+ from neris_api_client import NerisApiClient, Config
91
+
92
+ # Credentials must be defined in .env
93
+ load_dotenv()
94
+ client = NerisApiClient()
95
+
96
+ # Get an entity
97
+ entity = client.get_entity("FD24027240")
98
+ ```
99
+
100
+ ## Disclaimer
101
+ The models in this package are generated using [`datamodel-code-generator`](https://github.com/koxudaxi/datamodel-code-generator) and are not guaranteed
102
+ to contain all of the information present in the full specification. The generated models are used to validate request payloads prior to
103
+ API submission.
104
+
105
+ ## Additional Information
106
+ To ask a question, make a suggestion, or otherwise get help with the NERIS API Client, please visit [the NERIS helpdesk](https://neris.atlassian.net/servicedesk/customer/portals).
107
+
108
+ **Beta sandbox users**:
109
+ - Be sure to use the base URL `https://api-test.neris.fsri.org/v1` with the NERIS API Client. You will not be able to authenticate requests in the other environments.
110
+ - For the beta testing period, your user is only authorized to perform actions on behalf of the FSRI Fire Department `FD24027214`.
@@ -1,55 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: neris_api_client
3
- Version: 1.2.0rc2
4
- Summary: NERIS API Client
5
- Author-email: Ben Coleman <ben.coleman@ul.org>, Tommy Messbauer <thomas.messbauer@ul.org>
6
- Project-URL: Homepage, https://github.com/ulfsri/neris-api-client
7
- Project-URL: Issues, https://neris.atlassian.net/servicedesk/customer/portal/3/group/3/create/10027
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.8
12
- Description-Content-Type: text/markdown
13
- License-File: LICENSE
14
- Requires-Dist: requests
15
- Requires-Dist: pydantic[email]>=2
16
- Requires-Dist: python-dotenv
17
-
18
- # NERIS API Client
19
-
20
- A Python class to interact with the NERIS API programmatically.
21
-
22
- ## Usage
23
-
24
- To install:
25
- ```bash
26
- pip install neris-api-client
27
- ```
28
- Package lives on pypi: [`NERIS API Client`](https://pypi.org/project/neris-api-client/)
29
-
30
- The client requires a username and password for authentication and authorization of requests unless the `env` argument is set to `local`
31
- at instantiation. The `local` environment is intended for development use on local machines and bypasses auth.
32
-
33
- ```python
34
- from neris_api_client import NerisApiClient
35
-
36
- client = NerisApiClient(username="neris.user@email.co", password="*******", env="test")
37
-
38
- # Get an entity
39
- entity = client.get_entity("FD24027240")
40
- ```
41
-
42
- API auth tokens are cached locally in `./.token_cache`. If there are auth issues first try instantiating the client with `use_cache=False`
43
- keyword argument or deleting the token cache.
44
-
45
- ## Disclaimer
46
- The models in this package are generated using [`datamodel-code-generator`](https://github.com/koxudaxi/datamodel-code-generator) and are not guaranteed
47
- to contain all of the information present in the full specification. The generated models are used to validate request payloads prior to
48
- API submission.
49
-
50
- ## Additional Information
51
- To ask a question, make a suggestion, or otherwise get help with the NERIS API Client, please visit [the NERIS helpdesk](https://neris.atlassian.net/servicedesk/customer/portals).
52
-
53
- **Beta sandbox users**:
54
- - Be sure to use the `test` environment with the NERIS API Client. You will not be able to authenticate requests in the other environments.
55
- - For the beta testing period, your user is only authorized to perform actions on behalf of the FSRI Fire Department `FD24027214`.
@@ -1,38 +0,0 @@
1
- # NERIS API Client
2
-
3
- A Python class to interact with the NERIS API programmatically.
4
-
5
- ## Usage
6
-
7
- To install:
8
- ```bash
9
- pip install neris-api-client
10
- ```
11
- Package lives on pypi: [`NERIS API Client`](https://pypi.org/project/neris-api-client/)
12
-
13
- The client requires a username and password for authentication and authorization of requests unless the `env` argument is set to `local`
14
- at instantiation. The `local` environment is intended for development use on local machines and bypasses auth.
15
-
16
- ```python
17
- from neris_api_client import NerisApiClient
18
-
19
- client = NerisApiClient(username="neris.user@email.co", password="*******", env="test")
20
-
21
- # Get an entity
22
- entity = client.get_entity("FD24027240")
23
- ```
24
-
25
- API auth tokens are cached locally in `./.token_cache`. If there are auth issues first try instantiating the client with `use_cache=False`
26
- keyword argument or deleting the token cache.
27
-
28
- ## Disclaimer
29
- The models in this package are generated using [`datamodel-code-generator`](https://github.com/koxudaxi/datamodel-code-generator) and are not guaranteed
30
- to contain all of the information present in the full specification. The generated models are used to validate request payloads prior to
31
- API submission.
32
-
33
- ## Additional Information
34
- To ask a question, make a suggestion, or otherwise get help with the NERIS API Client, please visit [the NERIS helpdesk](https://neris.atlassian.net/servicedesk/customer/portals).
35
-
36
- **Beta sandbox users**:
37
- - Be sure to use the `test` environment with the NERIS API Client. You will not be able to authenticate requests in the other environments.
38
- - For the beta testing period, your user is only authorized to perform actions on behalf of the FSRI Fire Department `FD24027214`.
@@ -1,55 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: neris_api_client
3
- Version: 1.2.0rc2
4
- Summary: NERIS API Client
5
- Author-email: Ben Coleman <ben.coleman@ul.org>, Tommy Messbauer <thomas.messbauer@ul.org>
6
- Project-URL: Homepage, https://github.com/ulfsri/neris-api-client
7
- Project-URL: Issues, https://neris.atlassian.net/servicedesk/customer/portal/3/group/3/create/10027
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.8
12
- Description-Content-Type: text/markdown
13
- License-File: LICENSE
14
- Requires-Dist: requests
15
- Requires-Dist: pydantic[email]>=2
16
- Requires-Dist: python-dotenv
17
-
18
- # NERIS API Client
19
-
20
- A Python class to interact with the NERIS API programmatically.
21
-
22
- ## Usage
23
-
24
- To install:
25
- ```bash
26
- pip install neris-api-client
27
- ```
28
- Package lives on pypi: [`NERIS API Client`](https://pypi.org/project/neris-api-client/)
29
-
30
- The client requires a username and password for authentication and authorization of requests unless the `env` argument is set to `local`
31
- at instantiation. The `local` environment is intended for development use on local machines and bypasses auth.
32
-
33
- ```python
34
- from neris_api_client import NerisApiClient
35
-
36
- client = NerisApiClient(username="neris.user@email.co", password="*******", env="test")
37
-
38
- # Get an entity
39
- entity = client.get_entity("FD24027240")
40
- ```
41
-
42
- API auth tokens are cached locally in `./.token_cache`. If there are auth issues first try instantiating the client with `use_cache=False`
43
- keyword argument or deleting the token cache.
44
-
45
- ## Disclaimer
46
- The models in this package are generated using [`datamodel-code-generator`](https://github.com/koxudaxi/datamodel-code-generator) and are not guaranteed
47
- to contain all of the information present in the full specification. The generated models are used to validate request payloads prior to
48
- API submission.
49
-
50
- ## Additional Information
51
- To ask a question, make a suggestion, or otherwise get help with the NERIS API Client, please visit [the NERIS helpdesk](https://neris.atlassian.net/servicedesk/customer/portals).
52
-
53
- **Beta sandbox users**:
54
- - Be sure to use the `test` environment with the NERIS API Client. You will not be able to authenticate requests in the other environments.
55
- - For the beta testing period, your user is only authorized to perform actions on behalf of the FSRI Fire Department `FD24027214`.