diff --git a/cli/api.py b/cli/api.py index 22b11f137dbfc891e99e75a9f2e90d43566c3246..036123e34fc85e018d453cbf798d92fc5e97d582 100644 --- a/cli/api.py +++ b/cli/api.py @@ -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