pypomes-iam 0.5.2__tar.gz → 0.5.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.

Potentially problematic release.


This version of pypomes-iam might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pypomes_iam
3
- Version: 0.5.2
3
+ Version: 0.5.3
4
4
  Summary: A collection of Python pomes, penyeach (IAM modules)
5
5
  Project-URL: Homepage, https://github.com/TheWiseCoder/PyPomes-IAM
6
6
  Project-URL: Bug Tracker, https://github.com/TheWiseCoder/PyPomes-IAM/issues
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
6
6
 
7
7
  [project]
8
8
  name = "pypomes_iam"
9
- version = "0.5.2"
9
+ version = "0.5.3"
10
10
  authors = [
11
11
  { name="GT Nunes", email="wisecoder01@gmail.com" }
12
12
  ]
@@ -152,7 +152,7 @@ def _get_public_key(iam_server: IamServer,
152
152
  lifetime: int = registry["pk-lifetime"] or 0
153
153
  registry["pk-expiration"] = now + lifetime
154
154
  elif logger:
155
- msg: str = f"GET failure, status {response.status_code}, reason '{response.reason}'"
155
+ msg: str = f"GET failure, status {response.status_code}, reason {response.reason}"
156
156
  if hasattr(response, "content") and response.content:
157
157
  msg += f", content {response.content}"
158
158
  logger.error(msg=msg)
@@ -107,44 +107,44 @@ def provider_get_token(provider_id: str,
107
107
  if logger:
108
108
  logger.debug(msg=f"POST {url}, {json.dumps(obj=body_data,
109
109
  ensure_ascii=False)}")
110
- try:
111
- # typical return on a token request:
112
- # {
113
- # "token_type": "Bearer",
114
- # "access_token": <str>,
115
- # "expires_in": <number-of-seconds>,
116
- # optional data:
117
- # "refresh_token": <str>,
118
- # "refresh_expires_in": <number-of-seconds>
119
- # }
120
- response: requests.Response = requests.post(url=url,
121
- data=body_data,
122
- headers=headers_data,
123
- timeout=None)
124
- if response.status_code < 200 or response.status_code >= 300:
125
- # request resulted in error, report the problem
126
- err_msg = (f"POST failure, "
127
- f"status {response.status_code}, reason {response.reason}")
128
- else:
129
- # request succeeded
130
- if logger:
131
- logger.debug(msg=f"POST success, status {response.status_code}")
132
- reply: dict[str, Any] = response.json()
133
- provider["access-token"] = reply.get("access_token")
134
- provider["access-expiration"] = now + int(reply.get("expires_in"))
135
- if reply.get("refresh_token"):
136
- provider["refresh-token"] = reply["refesh_token"]
137
- if reply.get("refresh_expires_in"):
138
- provider["refresh-expiration"] = now + int(reply.get("refresh_expires_in"))
139
- else:
140
- provider["refresh-expiration"] = sys.maxsize
141
- if logger:
142
- logger.debug(msg=f"POST {url}: status {response.status_code}")
143
- except Exception as e:
144
- # the operation raised an exception
145
- err_msg = exc_format(exc=e,
146
- exc_info=sys.exc_info())
147
- err_msg = f"POST error, '{err_msg}'"
110
+ try:
111
+ # typical return on a token request:
112
+ # {
113
+ # "token_type": "Bearer",
114
+ # "access_token": <str>,
115
+ # "expires_in": <number-of-seconds>,
116
+ # optional data:
117
+ # "refresh_token": <str>,
118
+ # "refresh_expires_in": <number-of-seconds>
119
+ # }
120
+ response: requests.Response = requests.post(url=url,
121
+ data=body_data,
122
+ headers=headers_data,
123
+ timeout=None)
124
+ if response.status_code < 200 or response.status_code >= 300:
125
+ # request resulted in error, report the problem
126
+ err_msg = (f"POST failure, "
127
+ f"status {response.status_code}, reason {response.reason}")
128
+ else:
129
+ # request succeeded
130
+ if logger:
131
+ logger.debug(msg=f"POST success, status {response.status_code}")
132
+ reply: dict[str, Any] = response.json()
133
+ provider["access-token"] = reply.get("access_token")
134
+ provider["access-expiration"] = now + int(reply.get("expires_in"))
135
+ if reply.get("refresh_token"):
136
+ provider["refresh-token"] = reply["refesh_token"]
137
+ if reply.get("refresh_expires_in"):
138
+ provider["refresh-expiration"] = now + int(reply.get("refresh_expires_in"))
139
+ else:
140
+ provider["refresh-expiration"] = sys.maxsize
141
+ if logger:
142
+ logger.debug(msg=f"POST {url}: status {response.status_code}")
143
+ except Exception as e:
144
+ # the operation raised an exception
145
+ err_msg = exc_format(exc=e,
146
+ exc_info=sys.exc_info())
147
+ err_msg = f"POST error, '{err_msg}'"
148
148
  else:
149
149
  err_msg: str = f"Provider '{provider_id}' not registered"
150
150
 
File without changes
File without changes
File without changes