neris-api-client 1.3.0__tar.gz → 1.3.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.3.0/src/neris_api_client.egg-info → neris_api_client-1.3.2}/PKG-INFO +9 -1
- {neris_api_client-1.3.0 → neris_api_client-1.3.2}/README.md +8 -0
- {neris_api_client-1.3.0 → neris_api_client-1.3.2}/pyproject.toml +1 -1
- {neris_api_client-1.3.0 → neris_api_client-1.3.2}/src/neris_api_client/client.py +6 -6
- {neris_api_client-1.3.0 → neris_api_client-1.3.2}/src/neris_api_client/config.py +2 -0
- {neris_api_client-1.3.0 → neris_api_client-1.3.2/src/neris_api_client.egg-info}/PKG-INFO +9 -1
- {neris_api_client-1.3.0 → neris_api_client-1.3.2}/LICENSE +0 -0
- {neris_api_client-1.3.0 → neris_api_client-1.3.2}/setup.cfg +0 -0
- {neris_api_client-1.3.0 → neris_api_client-1.3.2}/src/neris_api_client/__init__.py +0 -0
- {neris_api_client-1.3.0 → neris_api_client-1.3.2}/src/neris_api_client/models.py +0 -0
- {neris_api_client-1.3.0 → neris_api_client-1.3.2}/src/neris_api_client.egg-info/SOURCES.txt +0 -0
- {neris_api_client-1.3.0 → neris_api_client-1.3.2}/src/neris_api_client.egg-info/dependency_links.txt +0 -0
- {neris_api_client-1.3.0 → neris_api_client-1.3.2}/src/neris_api_client.egg-info/requires.txt +0 -0
- {neris_api_client-1.3.0 → neris_api_client-1.3.2}/src/neris_api_client.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: neris_api_client
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.2
|
|
4
4
|
Summary: NERIS API Client
|
|
5
5
|
Author-email: Ben Coleman <ben.coleman@ul.org>, Tommy Messbauer <thomas.messbauer@ul.org>, Joseph Pagani <joseph.pagani@ul.org>
|
|
6
6
|
Project-URL: Homepage, https://github.com/ulfsri/neris-api-client
|
|
@@ -97,6 +97,14 @@ client = NerisApiClient()
|
|
|
97
97
|
entity = client.get_entity("FD24027240")
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
+
## Additional config parameters
|
|
101
|
+
|
|
102
|
+
| Parameter | Description |
|
|
103
|
+
| --------- | ----------------------------------------------------------- |
|
|
104
|
+
| debug | Controls whether the application outputs debug information. |
|
|
105
|
+
| validate | Controls whether the client performs model validations. |
|
|
106
|
+
|
|
107
|
+
|
|
100
108
|
## Disclaimer
|
|
101
109
|
The models in this package are generated using [`datamodel-code-generator`](https://github.com/koxudaxi/datamodel-code-generator) and are not guaranteed
|
|
102
110
|
to contain all of the information present in the full specification. The generated models are used to validate request payloads prior to
|
|
@@ -80,6 +80,14 @@ client = NerisApiClient()
|
|
|
80
80
|
entity = client.get_entity("FD24027240")
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
+
## Additional config parameters
|
|
84
|
+
|
|
85
|
+
| Parameter | Description |
|
|
86
|
+
| --------- | ----------------------------------------------------------- |
|
|
87
|
+
| debug | Controls whether the application outputs debug information. |
|
|
88
|
+
| validate | Controls whether the client performs model validations. |
|
|
89
|
+
|
|
90
|
+
|
|
83
91
|
## Disclaimer
|
|
84
92
|
The models in this package are generated using [`datamodel-code-generator`](https://github.com/koxudaxi/datamodel-code-generator) and are not guaranteed
|
|
85
93
|
to contain all of the information present in the full specification. The generated models are used to validate request payloads prior to
|
|
@@ -47,6 +47,7 @@ class _NerisApiClient:
|
|
|
47
47
|
case GrantType.CLIENT_CREDENTIALS:
|
|
48
48
|
assert config.client_id is not None
|
|
49
49
|
assert config.client_secret is not None
|
|
50
|
+
self.client_creds = base64.b64encode(f"{config.client_id}:{config.client_secret}".encode("utf-8")).decode("utf-8")
|
|
50
51
|
case GrantType.PASSWORD:
|
|
51
52
|
assert config.username is not None
|
|
52
53
|
assert config.password is not None
|
|
@@ -73,11 +74,9 @@ class _NerisApiClient:
|
|
|
73
74
|
)
|
|
74
75
|
|
|
75
76
|
case GrantType.CLIENT_CREDENTIALS:
|
|
76
|
-
client_creds = base64.b64encode(f"{self.config.client_id}:{self.config.client_secret}".encode("utf-8")).decode("utf-8")
|
|
77
|
-
|
|
78
77
|
res = self._session.post(
|
|
79
78
|
token_url,
|
|
80
|
-
headers={"Authorization": f"Basic {client_creds}",
|
|
79
|
+
headers={"Authorization": f"Basic {self.client_creds}", "Content-Type": "application/x-www-form-urlencoded"},
|
|
81
80
|
data={"grant_type": GrantType.CLIENT_CREDENTIALS},
|
|
82
81
|
)
|
|
83
82
|
|
|
@@ -87,7 +86,7 @@ class _NerisApiClient:
|
|
|
87
86
|
res = self._session.post(
|
|
88
87
|
token_url,
|
|
89
88
|
# No basic auth needed for Cognito refresh tokens
|
|
90
|
-
headers={
|
|
89
|
+
headers={"Content-Type": "application/x-www-form-urlencoded"},
|
|
91
90
|
data={
|
|
92
91
|
"grant_type": "refresh_token",
|
|
93
92
|
"refresh_token": self.tokens.refresh_token,
|
|
@@ -97,7 +96,8 @@ class _NerisApiClient:
|
|
|
97
96
|
case GrantType.CLIENT_CREDENTIALS:
|
|
98
97
|
res = self._session.post(
|
|
99
98
|
token_url,
|
|
100
|
-
|
|
99
|
+
# Basic auth required for NERIS refresh tokens
|
|
100
|
+
headers={"Authorization": f"Basic {self.client_creds}", "Content-Type": "application/x-www-form-urlencoded"},
|
|
101
101
|
data={
|
|
102
102
|
"grant_type": "refresh_token",
|
|
103
103
|
"refresh_token": self.tokens.refresh_token,
|
|
@@ -161,7 +161,7 @@ class _NerisApiClient:
|
|
|
161
161
|
self._update_auth()
|
|
162
162
|
self._session.headers.update({"Authorization": f"Bearer {self.tokens.access_token}"})
|
|
163
163
|
|
|
164
|
-
if model:
|
|
164
|
+
if self.config.validate and model:
|
|
165
165
|
if isinstance(data, str):
|
|
166
166
|
data = model.model_validate_json(data).model_dump(mode="json", by_alias=True)
|
|
167
167
|
if isinstance(data, dict):
|
|
@@ -16,11 +16,13 @@ class Config:
|
|
|
16
16
|
client_id: str | None = None
|
|
17
17
|
client_secret: str | None = None
|
|
18
18
|
grant_type: GrantType | None = None
|
|
19
|
+
validate: bool | None = None
|
|
19
20
|
|
|
20
21
|
def __post_init__(self):
|
|
21
22
|
# env var handling
|
|
22
23
|
self.base_url = self.base_url or os.getenv("NERIS_BASE_URL")
|
|
23
24
|
self.debug = self.debug if self.debug is not None else os.getenv("NERIS_DEBUG") == "true"
|
|
25
|
+
self.validate = self.validate if self.validate is not None else os.getenv("NERIS_VALIDATE") == "true"
|
|
24
26
|
|
|
25
27
|
match os.getenv("NERIS_GRANT_TYPE"):
|
|
26
28
|
case GrantType.PASSWORD:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: neris_api_client
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.2
|
|
4
4
|
Summary: NERIS API Client
|
|
5
5
|
Author-email: Ben Coleman <ben.coleman@ul.org>, Tommy Messbauer <thomas.messbauer@ul.org>, Joseph Pagani <joseph.pagani@ul.org>
|
|
6
6
|
Project-URL: Homepage, https://github.com/ulfsri/neris-api-client
|
|
@@ -97,6 +97,14 @@ client = NerisApiClient()
|
|
|
97
97
|
entity = client.get_entity("FD24027240")
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
+
## Additional config parameters
|
|
101
|
+
|
|
102
|
+
| Parameter | Description |
|
|
103
|
+
| --------- | ----------------------------------------------------------- |
|
|
104
|
+
| debug | Controls whether the application outputs debug information. |
|
|
105
|
+
| validate | Controls whether the client performs model validations. |
|
|
106
|
+
|
|
107
|
+
|
|
100
108
|
## Disclaimer
|
|
101
109
|
The models in this package are generated using [`datamodel-code-generator`](https://github.com/koxudaxi/datamodel-code-generator) and are not guaranteed
|
|
102
110
|
to contain all of the information present in the full specification. The generated models are used to validate request payloads prior to
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{neris_api_client-1.3.0 → neris_api_client-1.3.2}/src/neris_api_client.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{neris_api_client-1.3.0 → neris_api_client-1.3.2}/src/neris_api_client.egg-info/requires.txt
RENAMED
|
File without changes
|
{neris_api_client-1.3.0 → neris_api_client-1.3.2}/src/neris_api_client.egg-info/top_level.txt
RENAMED
|
File without changes
|