neris-api-client 1.3.1__tar.gz → 1.3.3__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.2
2
2
  Name: neris_api_client
3
- Version: 1.3.1
3
+ Version: 1.3.3
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "neris_api_client"
7
- version = "1.3.1"
7
+ version = "1.3.3"
8
8
  authors = [
9
9
  { name="Ben Coleman", email="ben.coleman@ul.org" },
10
10
  { name="Tommy Messbauer", email="thomas.messbauer@ul.org" },
@@ -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}", 'Content-Type': 'application/x-www-form-urlencoded'},
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={'Content-Type': 'application/x-www-form-urlencoded'},
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
- headers={"Authorization": f"Basic {client_creds}", 'Content-Type': 'application/x-www-form-urlencoded'},
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,
@@ -316,8 +316,8 @@ class NerisApiClient(_NerisApiClient):
316
316
  def create_api_integration(self, neris_id: str, title: str) -> Dict[str, Any]:
317
317
  return self._call("post", f"/account/integration/{neris_id}", data={ "title": title })
318
318
 
319
- def generate_api_secret(self, client_id: str) -> Dict[str, Any]:
320
- return self._call("post", f"/account/credential/{client_id}")
319
+ def generate_api_secret(self, client_id: str, title: str) -> Dict[str, Any]:
320
+ return self._call("post", f"/account/credential/{client_id}", data={ "title": title })
321
321
 
322
322
  def list_integrations(self, neris_id: str) -> Dict[str, Any]:
323
323
  return self._call("get", f"/account/integration/{neris_id}/list")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: neris_api_client
3
- Version: 1.3.1
3
+ Version: 1.3.3
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