add google pse support

This commit is contained in:
Taylor Wilsdon
2025-07-30 09:52:10 -04:00
parent 33c6484a74
commit f77f4d742d
5 changed files with 260 additions and 4 deletions

View File

@@ -51,6 +51,9 @@ SLIDES_READONLY_SCOPE = 'https://www.googleapis.com/auth/presentations.readonly'
TASKS_SCOPE = 'https://www.googleapis.com/auth/tasks'
TASKS_READONLY_SCOPE = 'https://www.googleapis.com/auth/tasks.readonly'
# Google Custom Search API scope
CUSTOM_SEARCH_SCOPE = 'https://www.googleapis.com/auth/cse'
# Base OAuth scopes required for user identification
BASE_SCOPES = [
USERINFO_EMAIL_SCOPE,
@@ -108,5 +111,9 @@ TASKS_SCOPES = [
TASKS_READONLY_SCOPE
]
CUSTOM_SEARCH_SCOPES = [
CUSTOM_SEARCH_SCOPE
]
# Combined scopes for all supported Google Workspace operations
SCOPES = list(set(BASE_SCOPES + CALENDAR_SCOPES + DRIVE_SCOPES + GMAIL_SCOPES + DOCS_SCOPES + CHAT_SCOPES + SHEETS_SCOPES + FORMS_SCOPES + SLIDES_SCOPES + TASKS_SCOPES))
SCOPES = list(set(BASE_SCOPES + CALENDAR_SCOPES + DRIVE_SCOPES + GMAIL_SCOPES + DOCS_SCOPES + CHAT_SCOPES + SHEETS_SCOPES + FORMS_SCOPES + SLIDES_SCOPES + TASKS_SCOPES + CUSTOM_SEARCH_SCOPES))

View File

@@ -15,7 +15,8 @@ from auth.scopes import (
CHAT_READONLY_SCOPE, CHAT_WRITE_SCOPE, CHAT_SPACES_SCOPE,
FORMS_BODY_SCOPE, FORMS_BODY_READONLY_SCOPE, FORMS_RESPONSES_READONLY_SCOPE,
SLIDES_SCOPE, SLIDES_READONLY_SCOPE,
TASKS_SCOPE, TASKS_READONLY_SCOPE
TASKS_SCOPE, TASKS_READONLY_SCOPE,
CUSTOM_SEARCH_SCOPE
)
logger = logging.getLogger(__name__)
@@ -30,7 +31,8 @@ SERVICE_CONFIGS = {
"chat": {"service": "chat", "version": "v1"},
"forms": {"service": "forms", "version": "v1"},
"slides": {"service": "slides", "version": "v1"},
"tasks": {"service": "tasks", "version": "v1"}
"tasks": {"service": "tasks", "version": "v1"},
"customsearch": {"service": "customsearch", "version": "v1"}
}
@@ -76,6 +78,9 @@ SCOPE_GROUPS = {
# Tasks scopes
"tasks": TASKS_SCOPE,
"tasks_read": TASKS_READONLY_SCOPE,
# Custom Search scope
"customsearch": CUSTOM_SEARCH_SCOPE,
}
# Service cache: {cache_key: (service, cached_time, user_email)}