felipeam86 / garpy

Make your garmin data yours again!
Apache License 2.0
31 stars 6 forks source link

Download fails with error code 402 (payment required) #10

Closed kuperov closed 3 years ago

kuperov commented 3 years ago

Hello,

Thank you for making such a useful package. I use it daily to summarize and analyze my workouts, and it has helped enormously in my fitness journey. The garmin site falls far, far short of what I needed, so your package really fills a gap.

Today the package stopped working, and I saw the following error output. I believe the HTTP code 402 means "payment required".

2021-02-26 12:07:52 INFO - Downloading the following formats: ('summary',) to this folder: <snip>
2021-02-26 12:07:52 INFO - Querying list of activities
2021-02-26 12:07:52 ERROR - Failed to fetch activities 0 to 99.
Response code: 402

Traceback (most recent call last):
  File "venv/bin/garpy", line 8, in <module>
    sys.exit(main())
  File "<projectdir>/venv/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "<projectdir>/venv/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "<projectdir>/venv/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "<projectdir>/venv/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "<projectdir>/venv/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "<projectdir>/venv/lib/python3.8/site-packages/garpy/cli.py", line 80, in download
    downloader(formats=formats, activity_id=activity_id)
  File "<projectdir>/venv/lib/python3.8/site-packages/garpy/download.py", line 134, in __call__
    activities = Activities.list(self.client)
  File "<projectdir>/venv/lib/python3.8/site-packages/garpy/activity.py", line 155, in list
    for activity in client.list_activities()
  File "<projectdir>/venv/lib/python3.8/site-packages/garpy/client.py", line 222, in list_activities
    response = self.get(
  File "<projectdir>/venv/lib/python3.8/site-packages/garpy/client.py", line 184, in get
    raise ConnectionError(err_message)
ConnectionError: Failed to fetch activities 0 to 99.
Response code: 402

garpy was invoked as follows, where GARMIN_USER and GARMIN_PASS correspond to (working) credentials for the garmin site.

venv/bin/garpy download -f summary -u $GARMIN_USER -p $GARMIN_PASS

Thanks again for your hard work maintaining this package.

Alex

felipeam86 commented 3 years ago

Thanks @kuperov for your kind words and for signaling this issue. I will work on this over the weekend and do a new release

felipeam86 commented 3 years ago

It turns out the url endpoints had changed. I have fixed it and did a new realease.

@kuperov, can you please upgrade (pip install -U garpy) and let me know if the issue is solved in your end?

kuperov commented 3 years ago

@felipeam86 It works beautifully. Thank you so much..

Dave-DigiMim commented 3 years ago

Thanks for the fix