Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 611ee897 authored by Freezed's avatar Freezed
Browse files

:goal: Catch and print errors in API response #1

parent c8d063a4
No related branches found
No related tags found
1 merge request!2Resolve "Create manual activity"
......@@ -2,8 +2,6 @@
API utilities
"""
from requests import HTTPError
from strava.api._helpers import client, url, json
......@@ -11,7 +9,10 @@ def post_activity(xargs):
"""API call to create an activity"""
response = client.post(url=url("/activities"), data=xargs)
try:
return json(response)
except HTTPError:
return response
if response.ok:
result = json(response)
else:
result = response.json()
return result
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment