pythonhttppython-requestsputstrava

How to update Strava activities using API in python?


I'm trying to update my Strava activities using python. I'm using the requests module to send GET, POST, and PUT requests. I am trying to update my activity using put but I keep on getting this error

{'errors': [{'code': 'not found', 'field': '', 'resource': 'Activity'}],'message': 'Resource Not Found'}

I have the write access token and I created a dictionary with the things I want to update but I still keep on getting this return. This is the line of code I'm using to try and update the activity

updateActivty = requests.put(updatableActivity_url, headers=write_header, data=changeDescription, verify=False).json()

Any ideas on what I'm doing wrong here? (Sorry if I formatted this question bad. It's my first post on stack overflow)


Solution

  • I figured it out. It turns out I was creating separate access tokens one with scope activity:write and another with scope activity:read. I had to create an access token with both scope activity:write and activity:read. It lets me update activities now