jat255 / strava-to-fittrackee

Connector to pull workouts from a Strava account and upload them to a FitTrackee instance
MIT License
11 stars 2 forks source link

poetry run python -m strava_to_fittrackee.s2f --sync returning erros #26

Open DW4y opened 1 month ago

DW4y commented 1 month ago

Hello,

I'm running into the next problem. Set all up like in the instructions and used poetry with pyenv 3.10.10

Using virtualenv: /home/pierre/.cache/pypoetry/virtualenvs/strava-to-fittrackee-JaUpv7uk-py3.10

but _poetry run python -m strava_tofittrackee.s2f --sync returns:

INFO:s2f:No FitTrackee workouts were found, so syncing all!
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/pierre/strava-to-fittrackee/strava_to_fittrackee/s2f.py", line 1189, in <module>
    sync_strava_with_fittrackee()
  File "/home/pierre/strava-to-fittrackee/strava_to_fittrackee/s2f.py", line 1095, in sync_strava_with_fittrackee
    activities = strava.get_activities(after=latest_dt, limit=None)
  File "/home/pierre/strava-to-fittrackee/strava_to_fittrackee/s2f.py", line 386, in get_activities
    custom_raise_for_status(r)
  File "/home/pierre/strava-to-fittrackee/strava_to_fittrackee/s2f.py", line 184, in custom_raise_for_status
    fifteen_usage, daily_usage = dict(r.headers)["X-RateLimit-Usage"].split(",")
KeyError: 'X-RateLimit-Usage'

I'm using Fittrackee behind traefik but all headers are forwarded correct (it also works with nextcloud what needs the headers).

Thanks!

jat255 commented 1 month ago

My best guess is that Traefik isn't actually forwarding all the headers? So X-RateLimit-Usage isn't present as expected?

The strava API explicitly states that they send that header: https://developers.strava.com/docs/rate-limits/, and I haven't seen this in any of my deployments before. You'd have to debug to see what keys are present in dict(r.headers) at that point