Skip to main content

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

Project description

PyPI License: MIT Python 3.10+

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.1.tar.gz (11.9 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.1-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gcal_sdk_ldraney-0.1.1.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gcal_sdk_ldraney-0.1.1.tar.gz
Algorithm Hash digest
SHA256 35faac026f96c7f3385946e348d703a2408701382ebb417093303381afcfe949
MD5 b8876a48b75e77f95b139f1fa10ae7c6
BLAKE2b-256 3c827f55ffcb2431257f13aa31a473fecbbb96aed269c21b779437a7ddc77f89

See more details on using hashes here.

Provenance

The following attestation bundles were made for gcal_sdk_ldraney-0.1.1.tar.gz:

Publisher: publish.yml on ldraney/gcal-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for gcal_sdk_ldraney-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 663cc70d378a4b7f400a0060adcd6ce8468f792a7964d238fbb25211f64d234d
MD5 a42b46fe166776a387e3b720ab623bdf
BLAKE2b-256 83d8c8fdf73f4ab673c808ac45a9eebf51d3dcfe49fb644fa9b77f43a2dfde24

See more details on using hashes here.

Provenance

The following attestation bundles were made for gcal_sdk_ldraney-0.1.1-py3-none-any.whl:

Publisher: publish.yml on ldraney/gcal-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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