Spaces:
Runtime error
Runtime error
changes
Browse files- app/gmail_auth.py +1 -5
app/gmail_auth.py
CHANGED
|
@@ -2,7 +2,6 @@ import os
|
|
| 2 |
from pathlib import Path
|
| 3 |
from app.core.config import settings
|
| 4 |
|
| 5 |
-
# CREATE TEMP DIRECTORY
|
| 6 |
AUTH_DIR = Path("/tmp/google_auth")
|
| 7 |
AUTH_DIR.mkdir(parents=True, exist_ok=True)
|
| 8 |
|
|
@@ -10,8 +9,6 @@ AUTH_DIR.mkdir(parents=True, exist_ok=True)
|
|
| 10 |
CREDENTIALS_PATH = AUTH_DIR / "credentials.json"
|
| 11 |
TOKEN_PATH = AUTH_DIR / "token.json"
|
| 12 |
|
| 13 |
-
# FORCE CREATE/VERIFY FILES AT RUNTIME
|
| 14 |
-
# (Removed 'if not exists' check to ensure they always write correctly from HF Secrets)
|
| 15 |
if "GOOGLE_CREDENTIALS" in os.environ:
|
| 16 |
CREDENTIALS_PATH.write_text(os.environ["GOOGLE_CREDENTIALS"])
|
| 17 |
else:
|
|
@@ -29,13 +26,12 @@ from langchain_google_community.gmail.utils import (
|
|
| 29 |
)
|
| 30 |
from langchain_google_community import GmailToolkit
|
| 31 |
|
| 32 |
-
# LOAD CREDENTIALS - Fixed parameter name to 'client_secrets_file'
|
| 33 |
credentials = get_gmail_credentials(
|
| 34 |
|
| 35 |
|
| 36 |
token_file=str(TOKEN_PATH.resolve()),
|
| 37 |
scopes=["https://mail.google.com/"],
|
| 38 |
-
client_sercret_file=str(CREDENTIALS_PATH.resolve()),
|
| 39 |
)
|
| 40 |
|
| 41 |
# BUILD API RESOURCE
|
|
|
|
| 2 |
from pathlib import Path
|
| 3 |
from app.core.config import settings
|
| 4 |
|
|
|
|
| 5 |
AUTH_DIR = Path("/tmp/google_auth")
|
| 6 |
AUTH_DIR.mkdir(parents=True, exist_ok=True)
|
| 7 |
|
|
|
|
| 9 |
CREDENTIALS_PATH = AUTH_DIR / "credentials.json"
|
| 10 |
TOKEN_PATH = AUTH_DIR / "token.json"
|
| 11 |
|
|
|
|
|
|
|
| 12 |
if "GOOGLE_CREDENTIALS" in os.environ:
|
| 13 |
CREDENTIALS_PATH.write_text(os.environ["GOOGLE_CREDENTIALS"])
|
| 14 |
else:
|
|
|
|
| 26 |
)
|
| 27 |
from langchain_google_community import GmailToolkit
|
| 28 |
|
|
|
|
| 29 |
credentials = get_gmail_credentials(
|
| 30 |
|
| 31 |
|
| 32 |
token_file=str(TOKEN_PATH.resolve()),
|
| 33 |
scopes=["https://mail.google.com/"],
|
| 34 |
+
client_sercret_file=str(CREDENTIALS_PATH.resolve()),
|
| 35 |
)
|
| 36 |
|
| 37 |
# BUILD API RESOURCE
|