Closed OvidiuTa closed 10 months ago
You could run it locally and then copy ~/.config/strava_offline/token.json
to the server.
Thanks for the hint! I was trying to run, then I got some errors regarding pulling bikes data. After going into the code and commented everything related to bikes, it worked.. not sure what is the cause.
Traceback (most recent call last): File "/home/azureuser/.local/bin/strava-offline", line 8, in
sys.exit(cli()) File "/home/azureuser/.local/lib/python3.8/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) File "/home/azureuser/.local/lib/python3.8/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/home/azureuser/.local/lib/python3.8/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/azureuser/.local/lib/python3.8/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/azureuser/.local/lib/python3.8/site-packages/click/core.py", line 783, in invoke return __callback(args, kwargs) File "/home/azureuser/.local/lib/python3.8/site-packages/strava_offline/config.py", line 36, in wrapper return f(config_class(config_kwargs), **f_kwargs) File "/home/azureuser/.local/lib/python3.8/site-packages/strava_offline/cli.py", line 29, in cli_sqlite sync.sync(config=config, strava=strava) File "/home/azureuser/.local/lib/python3.8/site-packages/strava_offline/sync.py", line 92, in sync sync_bikes(strava, db) File "/home/azureuser/.local/lib/python3.8/site-packages/strava_offline/sync.py", line 78, in sync_bikes table_bike.upsert(db, strava.get_bikes()) File "/home/azureuser/.local/lib/python3.8/site-packages/strava_offline/strava.py", line 72, in get_bikes return self.get_athlete()['bikes'] KeyError: 'bikes'
Do you have any bikes in https://www.strava.com/settings/gear? Could you perhaps add print(self.get_athlete())
at the beginning of https://github.com/liskin/strava-offline/blob/80746c13d96e043d026b9268972afd4e8c329998/src/strava_offline/strava.py#L71 and rerun strava-offline sqlite
and see if the response looks anything like the sample at https://developers.strava.com/docs/reference/#api-Athletes-getLoggedInAthlete?
Did you perhaps untick the permission to read athlete information when authorizing the app with Strava?
I mean, it's super easy to fix the get_bikes
method to not fail when there's no bikes
field in the response, I just wanted to understand what could cause this. In my response, there is 'shoes': []
even though I've never added any shoes to gear, so I'm somewhat confused why your response would be missing bikes
completely.
Indeed it as a permission error. The way how I obtain the token was not also for the profile. Now Is working. Many thanks for the prompt help!
Hello,
thanks for providing such a tool. I am trying to use this tool and initiate the first session, but unfortunately I am running it in a machine (Cloud) to which I cannot get a GUI for the browser. Is there any way to do the first authorization in an other way?
Many thanks!