Skip to content

Commit 74bd4a9

Browse files
committed
Revert max metrix url change
Bumped garth to 0.5.15 Some linting and spelling fixes
1 parent 841e1de commit 74bd4a9

File tree

5 files changed

+321
-106
lines changed

5 files changed

+321
-106
lines changed

example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def display_json(api_call, output):
174174
print(full_output)
175175

176176
# Save to a file
177-
output_filename = "reponse.json"
177+
output_filename = "response.json"
178178
with open(output_filename, "w") as file:
179179
file.write(full_output)
180180

garminconnect/__init__.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from typing import Any, Dict, List, Optional
88

99
import garth
10+
1011
from .fit import FitEncoderWeight
1112

1213
logger = logging.getLogger(__name__)
@@ -16,7 +17,12 @@ class Garmin:
1617
"""Class for fetching data from Garmin Connect."""
1718

1819
def __init__(
19-
self, email=None, password=None, is_cn=False, prompt_mfa=None, return_on_mfa=False
20+
self,
21+
email=None,
22+
password=None,
23+
is_cn=False,
24+
prompt_mfa=None,
25+
return_on_mfa=False,
2026
):
2127
"""Create a new class instance."""
2228
self.username = email
@@ -233,14 +239,18 @@ def login(self, /, tokenstore: Optional[str] = None) -> tuple[Any, Any]:
233239
self.display_name = self.garth.profile["displayName"]
234240
self.full_name = self.garth.profile["fullName"]
235241

236-
settings = self.garth.connectapi(self.garmin_connect_user_settings_url)
242+
settings = self.garth.connectapi(
243+
self.garmin_connect_user_settings_url
244+
)
237245
self.unit_system = settings["userData"]["measurementSystem"]
238246

239247
return None, None
240248
else:
241249
if self.return_on_mfa:
242250
token1, token2 = self.garth.login(
243-
self.username, self.password, return_on_mfa=self.return_on_mfa
251+
self.username,
252+
self.password,
253+
return_on_mfa=self.return_on_mfa,
244254
)
245255
else:
246256
token1, token2 = self.garth.login(
@@ -249,12 +259,14 @@ def login(self, /, tokenstore: Optional[str] = None) -> tuple[Any, Any]:
249259
self.display_name = self.garth.profile["displayName"]
250260
self.full_name = self.garth.profile["fullName"]
251261

252-
settings = self.garth.connectapi(self.garmin_connect_user_settings_url)
262+
settings = self.garth.connectapi(
263+
self.garmin_connect_user_settings_url
264+
)
253265
self.unit_system = settings["userData"]["measurementSystem"]
254266

255267
return token1, token2
256268

257-
def resume_login(self,client_state: dict, mfa_code: str):
269+
def resume_login(self, client_state: dict, mfa_code: str):
258270
"""Resume login using Garth."""
259271
result1, result2 = self.garth.resume_login(client_state, mfa_code)
260272

@@ -980,7 +992,12 @@ def get_device_last_used(self):
980992

981993
return self.connectapi(url)
982994

983-
def get_activities(self, start: int = 0, limit: int = 20, activitytype: Optional[str] = None):
995+
def get_activities(
996+
self,
997+
start: int = 0,
998+
limit: int = 20,
999+
activitytype: Optional[str] = None,
1000+
):
9841001
"""
9851002
Return available activities.
9861003
:param start: Starting activity offset, where 0 means the most recent activity
@@ -1393,7 +1410,7 @@ def get_activity_gear(self, activity_id):
13931410

13941411
return self.connectapi(url, params=params)
13951412

1396-
def get_gear_ativities(self, gearUUID, limit = 9999):
1413+
def get_gear_ativities(self, gearUUID, limit=9999):
13971414
"""Return activities where gear uuid was used.
13981415
:param gearUUID: UUID of the gear to get activities for
13991416
:param limit: Maximum number of activities to return (default: 9999)

0 commit comments

Comments
 (0)