Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions tapiriik/services/Strava/strava.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,22 @@ def DownloadActivity(self, svcRecord, activity):
return activity
activityID = activity.ServiceData["ActivityID"]

# Get the description (Notes)
activitydata = requests.get("https://www.strava.com/api/v3/activities/" + str(activityID), headers=self._apiHeaders(svcRecord))
if activitydata.status_code == 401:
raise APIException("No authorization to download activity", block=True, user_exception=UserException(UserExceptionType.Authorization, intervention_required=True))

try:
activitydata = activitydata.json()
except:
raise APIException("Activity data returned is not JSON")

if "message" in activitydata and activitydata["message"] == "Record Not Found":
raise APIException("Could not find activity")

if "description" in activitydata:
activity.Notes = activitydata["description"]

streamdata = requests.get("https://www.strava.com/api/v3/activities/" + str(activityID) + "/streams/time,altitude,heartrate,cadence,watts,temp,moving,latlng,distance,velocity_smooth", headers=self._apiHeaders(svcRecord))
if streamdata.status_code == 401:
raise APIException("No authorization to download activity", block=True, user_exception=UserException(UserExceptionType.Authorization, intervention_required=True))
Expand Down