File size: 511 Bytes
33ffec6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from app.core.config import settings
from langchain_google_community.gmail.utils import (
    build_resource_service,
    get_gmail_credentials,
)

from langchain_google_community import GmailToolkit
credentials = get_gmail_credentials(
    token_file=settings.GMAIL_TOKEN_PATH,
    scopes=["https://mail.google.com/"],
    client_sercret_file=settings.GMAIL_CREDENTIALS_PATH,
)

api_resource = build_resource_service(
    credentials=credentials
)

gmail_toolkit = GmailToolkit(
    api_resource=api_resource
)