Spaces:
Build error
Build error
Update google_sheets_utils.py
Browse files- google_sheets_utils.py +2 -1
google_sheets_utils.py
CHANGED
|
@@ -40,12 +40,13 @@ def get_credentials():
|
|
| 40 |
if not config:
|
| 41 |
return None
|
| 42 |
|
| 43 |
-
|
| 44 |
if not creds_file:
|
| 45 |
logging.error("Google Sheets credentials file path not found in .env file")
|
| 46 |
return None
|
| 47 |
|
| 48 |
try:
|
|
|
|
| 49 |
return Credentials.from_service_account_file(creds_file, scopes=SCOPES)
|
| 50 |
except Exception as e:
|
| 51 |
logging.error("Error creating credentials: %s", str(e))
|
|
|
|
| 40 |
if not config:
|
| 41 |
return None
|
| 42 |
|
| 43 |
+
creds_json = config.get('google_sheets_credentials_file')
|
| 44 |
if not creds_file:
|
| 45 |
logging.error("Google Sheets credentials file path not found in .env file")
|
| 46 |
return None
|
| 47 |
|
| 48 |
try:
|
| 49 |
+
creds_file = json.loads(creds_json)
|
| 50 |
return Credentials.from_service_account_file(creds_file, scopes=SCOPES)
|
| 51 |
except Exception as e:
|
| 52 |
logging.error("Error creating credentials: %s", str(e))
|