From 7d412c62ae9515170b3181595c2838c56968c5aa Mon Sep 17 00:00:00 2001 From: Alessandro De Noia Date: Mon, 6 Mar 2017 22:26:45 +0000 Subject: [PATCH] attempt to download gpx for activity without device data may give 204 response --- garminexport/garminclient.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/garminexport/garminclient.py b/garminexport/garminclient.py index ac8ea87..b3cde19 100755 --- a/garminexport/garminclient.py +++ b/garminexport/garminclient.py @@ -308,7 +308,11 @@ class GarminClient(object): # and is the one used when exporting through the Garmin # Connect web page. #response = self.session.get("https://connect.garmin.com/proxy/activity-service-1.1/gpx/activity/{}?full=true".format(activity_id)) - if response.status_code == 404: + + # A 404 (Not Found) or 204 (No Content) response are both indicators + # of a gpx file not being available for the activity. It may, for + # example be a manually entered activity without any device data. + if response.status_code in (404, 204): return None if response.status_code != 200: raise Exception(u"failed to fetch GPX for activity {}: {}\n{}".format(