Skip to content

Commit a1be902

Browse files
committed
Fixed stats_and_body_composition concatenate bug
Added example code to README
1 parent 500d942 commit a1be902

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,21 @@ except Exception: # pylint: disable=broad-except
159159
print("Unknown error occured during Garmin Connect Client get body composition")
160160
quit()
161161

162+
163+
"""
164+
Get stats and body composition data
165+
"""
166+
try:
167+
print(client.get_stats_and_body(today.isoformat()))
168+
except (
169+
GarminConnectConnectionError,
170+
GarminConnectAuthenticationError,
171+
GarminConnectTooManyRequestsError,
172+
) as err:
173+
print("Error occured during Garmin Connect Client get stats and body composition: %s" % err)
174+
quit()
175+
except Exception: # pylint: disable=broad-except
176+
print("Unknown error occured during Garmin Connect Client get stats and body composition")
177+
quit()
178+
162179
```

garminconnect/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def get_stats_and_body(self, cdate):
143143
"""
144144
Return activity data and body composition
145145
"""
146-
return self.get_stats(cdate) + self.get_body_composition(cdate)
146+
return ({**self.get_stats(cdate), **self.get_body_composition(cdate)})
147147

148148
def get_stats(self, cdate): # cDate = 'YYY-mm-dd'
149149
"""

garminconnect/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# -*- coding: utf-8 -*-
22
"""Python 3 API wrapper for Garmin Connect to get your statistics."""
33

4-
__version__ = "0.1.9"
4+
__version__ = "0.1.10"

0 commit comments

Comments
 (0)