@@ -17,7 +17,7 @@ pip install garminconnect
1717## Usage
1818
1919``` python
20- from datetime import date
20+ # !/usr/bin/env python3
2121
2222from garminconnect import (
2323 Garmin,
@@ -26,6 +26,9 @@ from garminconnect import (
2626 GarminConnectAuthenticationError,
2727)
2828
29+ from datetime import date
30+
31+
2932"""
3033Enable debug logging
3134"""
@@ -36,13 +39,27 @@ today = date.today()
3639
3740
3841"""
39- Initialize client with credentials
42+ Initialize Garmin client with credentials
43+ Only needed when your program is initialized
4044"""
41- client = Garmin(YOUR_EMAIL , YOUR_PASSWORD )
45+ try :
46+ client = Garmin(YOUR_EMAIL , YOUR_PASSWORD )
47+ except (
48+ GarminConnectConnectionError,
49+ GarminConnectAuthenticationError,
50+ GarminConnectTooManyRequestsError,
51+ ) as err:
52+ print (" Error occured during Garmin Connect Client init: %s " % err)
53+ quit ()
54+ except Exception : # pylint: disable=broad-except
55+ print (" Unknown error occured during Garmin Connect Client init" )
56+ quit ()
4257
4358
4459"""
45- Login to portal
60+ Login to Garmin Connect portal
61+ Only needed at start of your program
62+ The libary will try to relogin when session expires
4663"""
4764try :
4865 client.login()
0 commit comments