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-0.1.0.tar.gz (10.1 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-0.1.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gcal_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 353d694307bdd56a19b71f2a1f52ee68c7f97f5afca75b0a754bf107fe515cc8
MD5 53c805053f5399dc6152df6521a485bb
BLAKE2b-256 859956a728d9d4dc46a3f16a3a3b9bfe8326139cfbfd4fef6bb8fadba50d597c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gcal_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for gcal_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0bee0b43696a0e23b2c8c8a0d859c3a2f46363dd058f867af21a2763f2d2d312
MD5 c14313483bbcca24a77a63ed0d44395d
BLAKE2b-256 5958e0f655ae2b3190030a55df050382242a9bce6a19ca98475a6f8f8639c762

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