import wmill
from googleapiclient.discovery import build
def main(task_list_id: str = "@default"):
"""
Fetch all tasks from Google Tasks using OAuth2.
"""
# Get OAuth2 token from Windmill
# You need to create a Google OAuth resource in Windmill
google_auth = wmill.get_resource("REDACTED")
# Build the service with OAuth credentials
service = build('tasks', 'v1', credentials=google_auth)
try:
# List all task lists
results = service.tasklists().list(maxResults=10).execute()
tasksLists = results.get("items", [])
if not tasksLists:
print("No task lists found.")
return {"task_lists": [], "message": "No task lists found"}
all_data = []
print("Task lists:")
for taskList in tasksLists:
print(f"{taskList['title']} ({taskList['id']})")
except Exception as err:
print(f"Error: {err}")
return {"error": str(err)}
import wmill
from googleapiclient.discovery import build
def main(task_list_id: str = "@default"):
"""
Fetch all tasks from Google Tasks using OAuth2.
"""
# Get OAuth2 token from Windmill
# You need to create a Google OAuth resource in Windmill
google_auth = wmill.get_resource("REDACTED")
# Build the service with OAuth credentials
service = build('tasks', 'v1', credentials=google_auth)
try:
# List all task lists
results = service.tasklists().list(maxResults=10).execute()
tasksLists = results.get("items", [])
if not tasksLists:
print("No task lists found.")
return {"task_lists": [], "message": "No task lists found"}
all_data = []
print("Task lists:")
for taskList in tasksLists:
print(f"{taskList['title']} ({taskList['id']})")
except Exception as err:
print(f"Error: {err}")
return {"error": str(err)}