Skip to content

Commit 422c53b

Browse files
authored
Merge pull request #304 from fulopm/master
Implement querying daily lifestyle logging data
2 parents d7e5a9e + 2991759 commit 422c53b

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

demo.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ def __init__(self):
153153
"desc": f"Get stress data for '{config.today.isoformat()}'",
154154
"key": "get_all_day_stress",
155155
},
156+
"9": {
157+
"desc": f"Get lifestyle logging data for '{config.today.isoformat()}'",
158+
"key": "get_lifestyle_logging_data",
159+
},
156160
},
157161
},
158162
"3": {
@@ -3229,6 +3233,12 @@ def execute_api_call(api: Garmin, key: str) -> None:
32293233
method_name="get_intensity_minutes_data",
32303234
api_call_desc=f"api.get_intensity_minutes_data('{config.today.isoformat()}')",
32313235
),
3236+
"get_lifestyle_logging_data": lambda: call_and_display(
3237+
api.get_lifestyle_logging_data,
3238+
config.today.isoformat(),
3239+
method_name="get_lifestyle_logging_data",
3240+
api_call_desc=f"api.get_lifestyle_logging_data('{config.today.isoformat()}')",
3241+
),
32323242
# Historical Data & Trends
32333243
"get_daily_steps": lambda: call_and_display(
32343244
api.get_daily_steps,

garminconnect/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,10 @@ def __init__(
277277

278278
self.garmin_connect_training_plan_url = "/trainingplan-service/trainingplan"
279279

280+
self.garmin_connect_daily_lifestyle_logging_url = (
281+
"/lifestylelogging-service/dailyLog"
282+
)
283+
280284
self.garth = garth.Client(
281285
domain="garmin.cn" if is_cn else "garmin.com",
282286
pool_connections=20,
@@ -1300,6 +1304,15 @@ def get_stress_data(self, cdate: str) -> dict[str, Any]:
13001304

13011305
return self.connectapi(url)
13021306

1307+
def get_lifestyle_logging_data(self, cdate: str) -> dict[str, Any]:
1308+
"""Return lifestyle logging data for current user."""
1309+
1310+
cdate = _validate_date_format(cdate, "cdate")
1311+
url = f"{self.garmin_connect_daily_lifestyle_logging_url}/{cdate}"
1312+
logger.debug("Requesting lifestyle logging data")
1313+
1314+
return self.connectapi(url)
1315+
13031316
def get_rhr_day(self, cdate: str) -> dict[str, Any]:
13041317
"""Return resting heartrate data for current user."""
13051318

0 commit comments

Comments
 (0)