mirror of
https://github.com/joaovitoriasilva/endurain.git
synced 2026-01-09 15:57:59 -05:00
Fix date format for Garmin body composition API call
Changed the date format passed to api.get_body_composition from a datetime object to a string in 'YYYY-MM-DD' format to match API requirements. Also updated .gitignore to exclude .garminconnect files.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,6 +4,7 @@ docker-compose.yml
|
||||
.env
|
||||
|
||||
# aux folder
|
||||
.garminconnect
|
||||
aux_scripts/.garminconnect
|
||||
|
||||
# Python
|
||||
|
||||
@@ -82,12 +82,13 @@ def init_api(email, password):
|
||||
|
||||
date = get_date()
|
||||
date_object = datetime.datetime.strptime(date, "%d-%m-%Y")
|
||||
date_string = date_object.strftime("%Y-%m-%d")
|
||||
|
||||
if not api:
|
||||
api = init_api(email, password)
|
||||
|
||||
if api:
|
||||
garmin_bc = api.get_body_composition(date_object, date_object)
|
||||
garmin_bc = api.get_body_composition(date_string, date_string)
|
||||
|
||||
if garmin_bc is None:
|
||||
# Log an informational event if no body composition were found
|
||||
|
||||
Reference in New Issue
Block a user