Skip to main content

gcal-sdk

A clean, typed Python SDK for the Google Calendar API v3. Built on top of google-api-python-client with Pydantic v2 models.

Installation

pip install gcal-sdk

Authentication

The SDK loads OAuth credentials from default paths:

  • ~/secrets/google-oauth/credentials.json — OAuth client credentials
  • ~/secrets/google-oauth/token.json — refresh token + access token

These paths can be overridden when creating the client.

Usage

from datetime import datetime, timezone, timedelta
from gcal_sdk import GCalClient

client = GCalClient()

# List upcoming events
events = client.events.list("primary", time_min=datetime.now(timezone.utc))
for event in events:
    print(f"{event.summary} — {event.start}")

# Create an event
start = datetime.now(timezone.utc) + timedelta(hours=1)
end = start + timedelta(hours=1)
new_event = client.events.create(
    "primary",
    summary="Team meeting",
    start=start,
    end=end,
)
print(f"Created: {new_event.html_link}")

# Update an event
updated = client.events.patch(
    "primary",
    event_id=new_event.id,
    summary="Updated team meeting",
)

# Delete an event
client.events.delete("primary", event_id=new_event.id)

# List calendars
calendars = client.calendars.list()
for cal in calendars:
    print(f"{cal.summary} (primary={cal.primary})")

# Get primary calendar
primary = client.calendars.get("primary")

# Check free/busy
busy = client.freebusy.query(
    calendar_ids=["primary"],
    time_min=datetime.now(timezone.utc),
    time_max=datetime.now(timezone.utc) + timedelta(days=1),
)

Development

# Install in dev mode
pip install -e ".[dev]"

# Run tests (requires valid OAuth tokens)
pytest

License

MIT

Metadata

Release files for gcal-sdk 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gcal-sdk 0.1.0
File Size Uploaded
gcal_sdk-0.1.0.tar.gz 10.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gcal-sdk 0.1.0
File Interpreter ABI Platform
gcal_sdk-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.8 kB

Release files / gcal_sdk-0.1.0.tar.gz

Download URL gcal_sdk-0.1.0.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
353d694307bdd56a19b71f2a1f52ee68c7f97f5afca75b0a754bf107fe515cc8
BLAKE2b-256 checksum
How to use checksums
859956a728d9d4dc46a3f16a3a3b9bfe8326139cfbfd4fef6bb8fadba50d597c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / gcal_sdk-0.1.0-py3-none-any.whl

Download URL gcal_sdk-0.1.0-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0bee0b43696a0e23b2c8c8a0d859c3a2f46363dd058f867af21a2763f2d2d312
BLAKE2b-256 checksum
How to use checksums
5958e0f655ae2b3190030a55df050382242a9bce6a19ca98475a6f8f8639c762
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page