Skip to main content

Python Workflows

Client Initialization

Use this helper function from the AutoKitteh Python SDK:

from autokitteh.google import google_calendar_client

gcal = google_calendar_client("autokitteh_connection_name")

This helper function is documented here: https://autokitteh.readthedocs.io/en/latest/#autokitteh.google.google_calendar_client

The code above uses the AutoKitteh connection's authentication details automatically, and is equivalent to this code snippet

from google.auth.transport.requests import Request
import google.oauth2.credentials as credentials
import google.oauth2.service_account as service_account
from googleapiclient.discovery import build

scopes = [...]

if json_key:
info = json.loads(json_key)
creds = service_account.Credentials.from_service_account_info(info, scopes=scopes)
else:
creds = credentials.Credentials.from_authorized_user_info(...)
if creds.expired:
creds.refresh(Request())

gcal = build("calendar", "v3", credentials=creds)

API Reference

Python: https://developers.google.com/resources/api-libraries/documentation/calendar/v3/python/latest/

Code sample: https://github.com/autokitteh/kittehub/tree/main/samples/google/calendar

Overview: https://developers.google.com/calendar/api/guides/overview

REST: https://developers.google.com/calendar/api/v3/reference