Skip to main content

A clean, typed Python SDK for the Google Calendar API v3

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gcal_sdk_ldraney-0.1.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gcal_sdk_ldraney-0.1.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file gcal_sdk_ldraney-0.1.0.tar.gz.

File metadata

  • Download URL: gcal_sdk_ldraney-0.1.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for gcal_sdk_ldraney-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bc4359bff7f80292f7bb2e89d2cbd1d9d33e18e3c9dc15a9fa9727e302dc0221
MD5 51b4d72008d5b80b4df7234a63811634
BLAKE2b-256 a6924c7d9a8533caef50855791d1d7fc6d657030c8228eb41e94736c6947b509

See more details on using hashes here.

File details

Details for the file gcal_sdk_ldraney-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for gcal_sdk_ldraney-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a66d8695203ae909914536ea937736f9316ca5ff254e37aed535f28f172cc9eb
MD5 c999ae60861baa1a40d4099719661cd8
BLAKE2b-256 752aeadccd675bc85a219442e99d86e03ec12846f67ce0041846789328e9a991

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page