attempt to download gpx for activity without device data may give 204 response

This commit is contained in:
Alessandro De Noia 2017-03-06 22:26:45 +00:00 committed by petergardfjall
parent 93d27057dc
commit 7d412c62ae

View File

@ -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(