Closed imagineering-uk closed 2 years ago
This is my code, as I stripped it right down to just want steps...
#!/usr/bin/env python3
import logging
import datetime
from garminconnect import (
Garmin,
GarminConnectConnectionError,
GarminConnectTooManyRequestsError,
GarminConnectAuthenticationError,
)
# Configure debug logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
# Example dates
today = datetime.date.today()
lastweek = today - datetime.timedelta(days=7)
try:
# API
## Initialize Garmin api with your credentials
api = Garmin("**********", "***********")
## Login to Garmin Connect portal
api.login()
# USER STATISTICS LOGGED
## Get steps data for today 'YYYY-MM-DD'
logger.info(api.get_steps_data(today.isoformat()))
## Logout of Garmin Connect portal
api.logout()
except (
GarminConnectConnectionError,
GarminConnectAuthenticationError,
GarminConnectTooManyRequestsError,
) as err:
logger.error("Error occurred during Garmin Connect communication: %s", err)
Im going to close this issue, trying again it appears that it maybe from garmin side, where they dont allow many requests within a certain period of time. New day and it ran fine, tried again after 1 minute and got the error again. Will attempt again tomorrow and see if that is the issue.
Sorry, still getting the same issue after 8 hours. Any thoughts?
+1 I am getting the same error
Garmin block the login after a number of consecutives logins in certain time. I just implemented session saving to avoid this, and reuse sessions.
I tried the saved session but am not seeing api.session_data field. Anyone having the same issue? Just did pip install for latest version.
@leeen82 thats because the lastest changes, has not been updated in the pip package. If you want to try it, just download the module and use the local module file, until the package is realased.
I have created package version 0.1.45
When running from bash, the script executes, but Garmin appears to be blocking logins. It worked the very first time, but 20 seconds later it returned this as part of the HTML response in the shell.
This website is using a security service to protect itself from online attacks.
ERROR:main:Error occurred during Garmin Connect communication: Forbidden url: https://sso.garmin.com/sso/signin
Any thoughts? It did work the very first time it ran. Thanks