Wondering if someone could help - I'm trying to obtain totals for an athlete. I have managed to get all activities, but would also like totals.
This is the following code I am using:
stats_url = f"https://www.strava.com/api/v3/athletes/{client_id}/stats?"
f"access_token={access_token}"
statsresponse = requests.get(stats_url)
stats = statsresponse.json()
print('Stats API:', stats_url)
ride_total_year_calculated = round(stats['ytd_ride_totals']['distance']/1000,1 )
When copy and pasting the URL I get the following response:
{"message":"Forbidden","errors":[]}
I'm obviously doing something really stupid here, but can't see it right now!
For further info, the following works:
activities_url = f"https://www.strava.com/api/v3/athlete/activities?"
f"access_token={access_token}"
print('RESTful API:', activities_url)
response = requests.get(activities_url, params=params)
print(len(response.json()))
for i in range(0,len(response.json())):
activity = response.json()[i]
print('Disance:', activity['distance'], 'm')
print('Date:', activity['start_date'])
print('type:', activity['type'])