pypomes-iam 0.5.3__py3-none-any.whl → 0.5.5__py3-none-any.whl
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.
- pypomes_iam/provider_pomes.py +41 -41
- {pypomes_iam-0.5.3.dist-info → pypomes_iam-0.5.5.dist-info}/METADATA +1 -1
- {pypomes_iam-0.5.3.dist-info → pypomes_iam-0.5.5.dist-info}/RECORD +5 -5
- {pypomes_iam-0.5.3.dist-info → pypomes_iam-0.5.5.dist-info}/WHEEL +0 -0
- {pypomes_iam-0.5.3.dist-info → pypomes_iam-0.5.5.dist-info}/licenses/LICENSE +0 -0
pypomes_iam/provider_pomes.py
CHANGED
|
@@ -104,47 +104,47 @@ def provider_get_token(provider_id: str,
|
|
|
104
104
|
enc_bytes: bytes = b64encode(f"{user}:{pwd}".encode())
|
|
105
105
|
headers_data["Authorization"] = f"Basic {enc_bytes.decode()}"
|
|
106
106
|
url: str = provider.get("url")
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
107
|
+
if logger:
|
|
108
|
+
logger.debug(msg=f"POST {url}, {json.dumps(obj=body_data,
|
|
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["refresh_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
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pypomes_iam
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.5
|
|
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
|
|
@@ -4,9 +4,9 @@ pypomes_iam/iam_pomes.py,sha256=sB2DDCaN5nN6ehZH4HCsWxPM9IbP5IRt42UhIRtn07Q,2743
|
|
|
4
4
|
pypomes_iam/iam_services.py,sha256=fdpOc6EmCLcMtkhZU5OX9gYJIA1RNyM3JcoMX0RqwXA,11829
|
|
5
5
|
pypomes_iam/jusbr_pomes.py,sha256=cuQWB5OTeAHarmUqAGIU4udSEJA1C6W6lOtauWA7gqw,5904
|
|
6
6
|
pypomes_iam/keycloak_pomes.py,sha256=OvPhfUXpqxll-p6CdRq2j5jp5ST9Z0feXg6TVbqC2cY,6751
|
|
7
|
-
pypomes_iam/provider_pomes.py,sha256=
|
|
7
|
+
pypomes_iam/provider_pomes.py,sha256=EFgWZO7kdUVJ5_z8egdzG9nmmpa7wTXOyo9Ops5NAEE,7236
|
|
8
8
|
pypomes_iam/token_pomes.py,sha256=Bz9pT2oU6jTEr_ZEZEJ3kUjH3TfxRyY1_vR319v6CEo,6692
|
|
9
|
-
pypomes_iam-0.5.
|
|
10
|
-
pypomes_iam-0.5.
|
|
11
|
-
pypomes_iam-0.5.
|
|
12
|
-
pypomes_iam-0.5.
|
|
9
|
+
pypomes_iam-0.5.5.dist-info/METADATA,sha256=FvKoV08gCZ-WvswVzMMlEOFi6jPlNZba7zUPeLtIVLU,694
|
|
10
|
+
pypomes_iam-0.5.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
11
|
+
pypomes_iam-0.5.5.dist-info/licenses/LICENSE,sha256=YvUELgV8qvXlaYsy9hXG5EW3Bmsrkw-OJmmILZnonAc,1086
|
|
12
|
+
pypomes_iam-0.5.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|