bwilczynski / strava-cli

Strava command-line interface
MIT License
31 stars 17 forks source link

Add bulk upload (for migration from competing services) #9

Closed docsmooth closed 3 years ago

docsmooth commented 3 years ago

Update the CLI app rights to include Activity:write. Add function for uploading activities. Tested via GPX, others from documentation should work, but the XML parser may fail. I don't have any other data to test against, but tried to make it resilient, since the API supports many file types.

Because of app rate limiting, I had to put a 15 minute sleep in the code after 90 items (rather than 100, explained in comments).

I tried to catch this in the "api/upload.py" rather than commands/upload.py", except I ran into this: except HTTPError as e: if e.code == 429:

But e doesn't have a "code" or "reason" attribute as the urllib and requests documents explain. I'm not sure what the problem is there, but when we CAN capture that error, we should move the rate limiting to the API code.

bwilczynski commented 3 years ago

Looks great. Thanks for your contribution.