Skip to content

Commit d271b6b

Browse files
Use global error handling for validate_challenge
1 parent 9f26711 commit d271b6b

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed
1.81 KB
Binary file not shown.

authsignal/client.py

+10-14
Original file line numberDiff line numberDiff line change
@@ -267,21 +267,17 @@ def validate_challenge(self, token: str, user_id: Optional[str] = None, action:
267267
'Accept': 'application/json'
268268
}
269269

270+
response = self.session.post(
271+
path,
272+
auth=requests.auth.HTTPBasicAuth(self.api_key, ''),
273+
data=json.dumps({'token': token, 'userId': user_id, 'action': action}),
274+
headers=headers,
275+
timeout=self.timeout
276+
)
277+
278+
response_data = response.json()
270279

271-
try:
272-
response = self.session.post(
273-
path,
274-
auth=requests.auth.HTTPBasicAuth(self.api_key, ''),
275-
data=json.dumps({'token': token, 'userId': user_id, 'action': action}),
276-
headers=headers,
277-
timeout=self.timeout
278-
)
279-
280-
response_data = response.json()
281-
282-
return response_data
283-
except requests.exceptions.RequestException as e:
284-
raise ApiException(str(e), path) from e
280+
return response_data
285281

286282
def _default_headers(self):
287283
return {'Content-type': 'application/json',

0 commit comments

Comments
 (0)