WindmillWWindmill
Powered by
MathisGM
Windmill•5mo ago•
4 replies
MathisG

How to access any Google Api (Google Tasks) from windmill ?

Hi there, coming in from n8n

I'm having issues understanding what ressource type to use for google oatuh using a google cloud platform project.

1. Created the gcp project
2. Added the appopriate APIs
3. Created a web app client
4. Activated Google
gcloud
gcloud
oatuh from dashboard
5. Created an associated ressource, asking for the appropriate google tasks API scopes
6. Logged in the pop-up

But now I can't use the ressource because all it has stored is a private key of some sort and it is useless in that way :

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)}
WindmillJoin
3,362Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?
Recent Announcements
henri-c

Weekly kenote to tell you about our latest updates https://discord.com/channels/930051556043276338/1278977038430240813 https://youtube.com/live/2dGd9TdT8xs?feature=share

henri-c · 4d ago

Pyra

### HTTP tracing (EE) Capture HTTP requests made by job scripts as observability spans Features: - View HTTP request traces (method, URL, status, timing) in the job details UI - Auto-instrumentation for Native TypeScript, MITM proxy for other languages - Integrates with external OpenTelemetry collectors changelog: https://www.windmill.dev/changelog/http-tracing docs: https://www.windmill.dev/docs/advanced/instance_settings#http-tracing Additionally jobs memory metrics are now fully OSS!

Pyra · 2w ago

henri-c

First keynote of the year here https://discord.com/channels/930051556043276338/1278977038430240813 🙂

henri-c · 4w ago

Similar Threads

How to copy all windmill artifacts from windmill base image?
ericEeric / help
3y ago
Windmill Rest API,
ESiteHosterEESiteHoster / help
3y ago
How to write windmill variables from scripts
AngadAAngad / help
3y ago
Windmill as Headless CMS with windmill rest API
ESiteHosterEESiteHoster / help
3y ago