tcgoetz / GarminDB

Download and parse data from Garmin Connect or a Garmin watch, FitBit CSV, and MS Health CSV files into and analyze data in Sqlite serverless databases with Jupyter notebooks.
GNU General Public License v2.0
1.1k stars 138 forks source link

Can't download activities since somes weeks #201

Closed Preliator-code closed 10 months ago

Preliator-code commented 11 months ago

Good morning,

I have been using Garmindb for over 2 years. For several weeks, I have been unable to download my activities with the command (screen attached) : python C:/OSGeo4W/apps/Python39/Lib/site-packages/bin/garmindb_cli.py --all --download --import --analyze 2023-10-09_084005

In the end of command, i can see '404 Client Error: Not Found for url: https://connectapi.garmin.com/download-service/files/wellness/2023-01-15'

-> And indeed, this link return nothing 2023-10-09_084005

I reproduce the same error with another PC on which I installed Garmindb a few months ago and which worked very well at the time.

I updated and uninstalled/reinstalled Garmindb, it doesn't change anything.

Has this ever happened to anyone ? Thanks

tcgoetz commented 11 months ago

What version are you using? A new version was released this week to address login issues.

Preliator-code commented 11 months ago

I have the same error even with pip install --upgrade garmindb

I can see "garmindb 3.5.0

fabianstamp commented 11 months ago

I cloned the repository today (v3.5) and I am encountering the same error with garmindb_cli.py --all --download --import --analyze: HTTPError: 404 Client Error: Not Found for url: https://connectapi.garmin.com/download-service/files/wellness/2022-10-11

tcgoetz commented 11 months ago

Oh, right, because it's asking for dates in the future,

fabianstamp commented 11 months ago

I have tried it now on mac and windows. Both with the most recent version. Is there an easy work around to deal with this? My dates are all in the past.

tcgoetz commented 11 months ago

In the URL above, the date was 2022-10-11, but the comment date was the 9th. That's why I was saying the the date was in the future. If a date in the future is requested via that URL the garmin api will respond with 404. I am not sure why it GarminDb is requesting a future date since I can not reproduce that behavior.

As to your later comment that "My dates are in the past>" are you saying your dates are in the past and you're still getting a 404? If so can you reply with an error and stack for that?

atusiniida commented 11 months ago

I faced the same problem. "2022" -10-11 is the past date, isn't it? Thank you for your help!

wngr commented 10 months ago

Facing a similar(?) issue:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/garth/http.py", line 125, in request
    self.last_resp.raise_for_status()
  File "/usr/local/lib/python3.10/dist-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://connectapi.garmin.com/download-service/files/wellness/2023-09-13

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/garmindb/download.py", line 119, in save_binary_file
    response = self.garth.get("connectapi", url, api=True)
  File "/usr/local/lib/python3.10/dist-packages/garth/http.py", line 134, in get
    return self.request("GET", *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/garth/http.py", line 127, in request
    raise GarthHTTPError(
garth.exc.GarthHTTPError: Error in request: 404 Client Error: Not Found for url: https://connectapi.garmin.com/download-service/files/wellness/2023-09-13

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/garmindb_cli.py", line 366, in <module>
    main(sys.argv[1:])
  File "/usr/local/bin/garmindb_cli.py", line 347, in main
    download_data(args.overwrite, args.latest, args.stats)
  File "/usr/local/bin/garmindb_cli.py", line 132, in download_data
    download.get_monitoring(ConfigManager.get_or_create_monitoring_dir, date, days)
  File "/usr/local/lib/python3.10/dist-packages/garmindb/download.py", line 169, in get_monitoring
    self.__get_monitoring_day(day_date)
  File "/usr/local/lib/python3.10/dist-packages/garmindb/download.py", line 159, in __get_monitoring_day
    self.save_binary_file(zip_filename, url)
  File "/usr/local/lib/python3.10/dist-packages/garmindb/download.py", line 124, in save_binary_file
    raise RestException(e, error=f'failed to save as binary: {e}')
idbutils.rest_client.RestException: <RestException() {'inner_exception': GarthHTTPError(msg='Error in request', error=HTTPError('404 Client Error: Not Found for url: https://connectapi.garmin.com/download-service/files/wellness/2023-09-13')), 'error': 'failed to save as binary: Error in request: 404 Client Error: Not Found for url: https://connectapi.garmin.com/download-service/files/wellness/2023-09-13'}>

Let me know if/how I should/can provide more data.

tcgoetz commented 10 months ago

garth.exc.GarthHTTPError: Error in request: 404 Client Error: Not Found for url: https://connectapi.garmin.com/download-service/files/wellness/2023-09-13

At the time you ran this, did you have data for 2023-09-12 or 2023-09-14? Was 2023-09-13 past the end of where you had data? Did you have data for 2023-09-13?

wngr commented 10 months ago

How can I assess that? It's currently reproducible, so happy to try stuff ..

askogrand commented 10 months ago

I am in the same boat. A month back I was able to download everything, no issue. Rebuilding health data today, I seem to be stuck on an old wellness file that is giving a 404:

 16%|██████▏                               | 288/1758 [07:20<37:26,  1.53s/days]
Traceback (most recent call last):
  File "/Users/andy/.pyenv/versions/3.10.0/lib/python3.10/site-packages/garth/http.py", line 125, in request
    self.last_resp.raise_for_status()
  File "/Users/andy/.pyenv/versions/3.10.0/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://connectapi.garmin.com/download-service/files/wellness/2019-10-16

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/andy/.pyenv/versions/3.10.0/lib/python3.10/site-packages/garmindb/download.py", line 119, in save_binary_file
    response = self.garth.get("connectapi", url, api=True)
  File "/Users/andy/.pyenv/versions/3.10.0/lib/python3.10/site-packages/garth/http.py", line 134, in get
    return this.request("GET", *args, **kwargs)
  File "/Users/andy/.pyenv/versions/3.10.0/lib/python3.10/site-packages/garth/http.py", line 127, in request
    raise GarthHTTPError(
garth.exc.GarthHTTPError: Error in request: 404 Client Error: Not Found for url: https://connectapi.garmin.com/download-service/files/wellness/2019-10-16

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/andy/.pyenv/versions/3.10.0/bin/garmindb_cli.py", line 366, in <module>
    main(sys.argv[1:])
  File "/Users/andy/.pyenv/versions/3.10.0/bin/garmindb_cli.py", line 347, in main
    download_data(args.overwrite, args.latest, args.stats)
  File "/Users/andy/.pyenv/versions/3.10.0/bin/garmindb_cli.py", line 132, in download_data
    download.get_monitoring(ConfigManager.get_or_create_monitoring_dir, date, days)
  File "/Users/andy/.pyenv/versions/3.10.0/lib/python3.10/site-packages/garmindb/download.py", line 169, in get_monitoring
    this.__get_monitoring_day(day_date)
  File "/Users/andy/.pyenv/versions/3.10.0/lib/python3.10/site-packages/garmindb/download.py", line 159, in __get_monitoring_day
    this.save_binary_file(zip_filename, url)
  File "/Users/andy/.pyenv/versions/3.10.0/lib/python3.10/site-packages/garmindb/download.py", line 124, in save_binary_file
    raise RestException(e, error=f'failed to save as binary: {e}')
idbutils.rest_client.RestException: <RestException() {'inner_exception': GarthHTTPError(msg='Error in request', error=HTTPError('404 Client Error: Not Found for url: https://connectapi.garmin.com/download-service/files/wellness/2019-10-16')), 'error': 'failed to save as binary: Error in request: 404 Client Error: Not Found for url: https://connectapi.garmin.com/download-service/files/wellness/2019-10-16'}>
tcgoetz commented 10 months ago

I think I've made progress on this in the develop branch. I should be able to work on this more this coming weekend.

tcgoetz commented 10 months ago

Please retry with 3.5.1+.

wngr commented 10 months ago

Awesome, thank you -- that worked!

Preliator-code commented 10 months ago

Same for me, thank you so much :)