Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download_activity is broken with Garth #155

Closed
julienroulle opened this issue Sep 19, 2023 · 6 comments
Closed

Download_activity is broken with Garth #155

julienroulle opened this issue Sep 19, 2023 · 6 comments

Comments

@julienroulle
Copy link

Tried upgrading garminconnect today, and the download_activity in one of my scripts failed. I tried the example.py file in the repo, and the same thing happened.

api.download_activity(12052308637, dl_fmt=api.ActivityDownloadFormat.GPX)
Traceback (most recent call last):
  File "example.py", line 666, in <module>
    switch(api, option)
  File "example.py", line 382, in switch
    gpx_data = api.download_activity(
               ^^^^^^^^^^^^^^^^^^^^^^
  File "garminconnect/__init__.py", line 832, in download_activity
    return self.download(url)
           ^^^^^^^^^^^^^^^^^^
  File "garminconnect/__init__.py", line 154, in download
    return self.garth.download(path, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
AttributeError: 'Client' object has no attribute 'download'

I am not sure what Garth is, so I don't have any solution (yet). I'll try and have a look at it later

@cyberjunky
Copy link
Owner

cyberjunky commented Sep 19, 2023

Garth is the name of another garminconnect package, and we now use the authentication and data fetching api only, instead of the code we had, the rest is the same. The advantage of Garth is that it uses the mobile app endpoints instead of the website, the mobile endpoints don't have Cloudflare in between (if I'm correct)

I just tested downloading with example.py (option p) and it still works here.
I think your code is wrong, the calls are like this where api is not garth, but just like below and there is no .download() it's called download_activity()

api = Garmin(email, password)
api.login()

gpx_data = api.download_activity(
       activity_id, dl_fmt=api.ActivityDownloadFormat.GPX
)

@julienroulle
Copy link
Author

Thanks for your answer. You are right.

My problem was that garth was at version 0.4.18, because I need to have pydantic on version 1, because of sqlmodel.
But garth 0.4.25 needs pydantic > 2. Now with garth 0.4.25 i can confirm download is working, but it does not work with previous versions of garth

@cyberjunky
Copy link
Owner

Ah oke, Garth is new for me too, thanks for the update. Can I close it?

@matin
Copy link
Contributor

matin commented Sep 19, 2023

This issue was also reported in #141 (comment).

It was fixed in 0.4.23.

@cyberjunky I recommend making 0.4.23 the minimum version in pyproject.toml. Doing so would ensure no one else faces this issue.

@matin
Copy link
Contributor

matin commented Sep 30, 2023

@julienroulle Garth 0.4.34 now supports Pydantic >= 1.10.13, which is within the supported range of sqlmodel. See #162 for more details.

@julienroulle
Copy link
Author

@julienroulle Garth 0.4.34 now supports Pydantic >= 1.10.13, which is within the supported range of sqlmodel. See #162 for more details.

Really appreciate you taking the time to update me on this. Thanks for your work !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants