Skip to content

Commit

Permalink
Merge pull request cyberjunky#174 from matin/reload
Browse files Browse the repository at this point in the history
Added request reload of old data call
  • Loading branch information
cyberjunky authored Nov 21, 2023
2 parents 908f478 + 38402b2 commit 9abdb6f
Show file tree
Hide file tree
Showing 4 changed files with 761 additions and 1 deletion.
13 changes: 13 additions & 0 deletions garminconnect/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ def __init__(self, email=None, password=None, is_cn=False):
self.garmin_connect_gear = "/gear-service/gear/filterGear"
self.garmin_connect_gear_baseurl = "/gear-service/gear/"

self.garmin_request_reload_url = "/wellness-service/wellness/epoch/request"

self.garth = garth.Client(
domain="garmin.cn" if is_cn else "garmin.com"
)
Expand Down Expand Up @@ -1068,6 +1070,17 @@ def get_user_profile(self):

return self.connectapi(url)

def request_reload(self, cdate: str):
"""
Request reload of data for a specific date. This is necessary because
Garmin offloads older data.
"""

url = f"{self.garmin_request_reload_url}/{cdate}"
logger.debug(f"Requesting reload of data for {cdate}.")

return self.garth.post("connectapi", url, api=True)

def logout(self):
"""Log user out of session."""

Expand Down
2 changes: 1 addition & 1 deletion garminconnect/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.9"
__version__ = "0.2.10"
Loading

0 comments on commit 9abdb6f

Please sign in to comment.