diff options
Diffstat (limited to 'hommaexceli_py/sheets_client.py')
| -rw-r--r-- | hommaexceli_py/sheets_client.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/hommaexceli_py/sheets_client.py b/hommaexceli_py/sheets_client.py index 6ce6a16..b30eb3d 100644 --- a/hommaexceli_py/sheets_client.py +++ b/hommaexceli_py/sheets_client.py @@ -1,5 +1,6 @@ import pickle import os.path +import logging from os import getenv from datetime import date from dataclasses import dataclass @@ -39,6 +40,7 @@ def _row_to_dataclass(values): def authenticate_and_fetch_sheets_data(): + logging.info("Reading Google credentials and authenticating...") creds = None # The file token.pickle stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first @@ -57,9 +59,10 @@ def authenticate_and_fetch_sheets_data(): with open("token.pickle", "wb") as token: pickle.dump(creds, token) - service = build("sheets", "v4", credentials=creds) + service = build("sheets", "v4", credentials=creds, cache_discovery=False) # Call the Sheets API + logging.info("Calling Sheets API to fetch data...") sheet = service.spreadsheets() result = ( sheet.values() @@ -71,4 +74,5 @@ def authenticate_and_fetch_sheets_data(): ) rows = result.get("values", []) + logging.info(f"Fetched {len(rows)} rows of data") return map(_row_to_dataclass, rows) |
