From 01a08e14abdc6919758edd8a63b10e7f14196865 Mon Sep 17 00:00:00 2001 From: petergardfjall Date: Thu, 30 Aug 2018 19:51:25 +0200 Subject: [PATCH] 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..) --- garminexport/garminclient.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/garminexport/garminclient.py b/garminexport/garminclient.py index c22f3b3..268046b 100755 --- a/garminexport/garminclient.py +++ b/garminexport/garminclient.py @@ -318,7 +318,11 @@ class GarminClient(object): :rtype: (str, str) """ 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 return (None,None) if response.status_code != 200: