neris-api-client 1.0.0__tar.gz → 1.1.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.
- {neris_api_client-1.0.0/src/neris_api_client.egg-info → neris_api_client-1.1.0}/PKG-INFO +1 -1
- {neris_api_client-1.0.0 → neris_api_client-1.1.0}/pyproject.toml +1 -1
- {neris_api_client-1.0.0 → neris_api_client-1.1.0}/src/neris_api_client/client.py +31 -5
- {neris_api_client-1.0.0 → neris_api_client-1.1.0}/src/neris_api_client/models.py +708 -717
- {neris_api_client-1.0.0 → neris_api_client-1.1.0/src/neris_api_client.egg-info}/PKG-INFO +1 -1
- {neris_api_client-1.0.0 → neris_api_client-1.1.0}/LICENSE +0 -0
- {neris_api_client-1.0.0 → neris_api_client-1.1.0}/README.md +0 -0
- {neris_api_client-1.0.0 → neris_api_client-1.1.0}/setup.cfg +0 -0
- {neris_api_client-1.0.0 → neris_api_client-1.1.0}/src/neris_api_client/__init__.py +0 -0
- {neris_api_client-1.0.0 → neris_api_client-1.1.0}/src/neris_api_client.egg-info/SOURCES.txt +0 -0
- {neris_api_client-1.0.0 → neris_api_client-1.1.0}/src/neris_api_client.egg-info/dependency_links.txt +0 -0
- {neris_api_client-1.0.0 → neris_api_client-1.1.0}/src/neris_api_client.egg-info/requires.txt +0 -0
- {neris_api_client-1.0.0 → neris_api_client-1.1.0}/src/neris_api_client.egg-info/top_level.txt +0 -0
|
@@ -116,11 +116,37 @@ class _NerisApiClient:
|
|
|
116
116
|
|
|
117
117
|
@_fetch_cognito_config
|
|
118
118
|
def _initiate_auth(self) -> None:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
try:
|
|
120
|
+
res = self._cognito.initiate_auth(
|
|
121
|
+
AuthFlow="USER_PASSWORD_AUTH",
|
|
122
|
+
AuthParameters={"USERNAME": self._username, "PASSWORD": self._password},
|
|
123
|
+
ClientId=self._cognito_config["client_id"],
|
|
124
|
+
)
|
|
125
|
+
except self._cognito.exceptions.LimitExceededException as e:
|
|
126
|
+
print(e.response["message"])
|
|
127
|
+
return
|
|
128
|
+
|
|
129
|
+
if "AuthenticationResult" not in res:
|
|
130
|
+
challenge_name = res["ChallengeName"]
|
|
131
|
+
|
|
132
|
+
answer = input(f"Provide MFA auth challenge answer for {challenge_name}: ")
|
|
133
|
+
|
|
134
|
+
while True:
|
|
135
|
+
try:
|
|
136
|
+
res = self._cognito.respond_to_auth_challenge(
|
|
137
|
+
ClientId=self._cognito_config["client_id"],
|
|
138
|
+
Session=res["Session"],
|
|
139
|
+
ChallengeName=challenge_name,
|
|
140
|
+
ChallengeResponses={
|
|
141
|
+
"USERNAME": self._username,
|
|
142
|
+
f"{challenge_name}_CODE": answer,
|
|
143
|
+
},
|
|
144
|
+
)
|
|
145
|
+
break
|
|
146
|
+
except self._cognito.exceptions.CodeMismatchException as e:
|
|
147
|
+
print(e.response["message"])
|
|
148
|
+
# Keep trying until the answer is correct
|
|
149
|
+
answer = input(f"Provide MFA auth challenge answer for {challenge_name}: ")
|
|
124
150
|
|
|
125
151
|
self._access_token = res["AuthenticationResult"]["AccessToken"]
|
|
126
152
|
self._refresh_token = res["AuthenticationResult"]["RefreshToken"]
|