trying to download a .fit file for an activity without one now appears to result in a 500 response (although a 404 would seem more appropriate..)

This commit is contained in:
petergardfjall 2018-08-30 19:51:25 +02:00
parent 769d02b2a2
commit 01a08e14ab

View File

@ -318,7 +318,11 @@ class GarminClient(object):
:rtype: (str, str) :rtype: (str, str)
""" """
response = self.session.get("https://connect.garmin.com/modern/proxy/download-service/files/activity/{}".format(activity_id)) response = self.session.get("https://connect.garmin.com/modern/proxy/download-service/files/activity/{}".format(activity_id))
if response.status_code == 404: # A 404 (Not Found) response is a clear indicator of a missing .fit
# file. As of lately, the endpoint appears to have started to
# respond with 500 "NullPointerException" on attempts to download a
# .fit file for an activity without one.
if response.status_code in [404, 500]:
# Manually entered activity, no file source available # Manually entered activity, no file source available
return (None,None) return (None,None)
if response.status_code != 200: if response.status_code != 200: