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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35faac026f96c7f3385946e348d703a2408701382ebb417093303381afcfe949
|
|
| MD5 |
b8876a48b75e77f95b139f1fa10ae7c6
|
|
| BLAKE2b-256 |
3c827f55ffcb2431257f13aa31a473fecbbb96aed269c21b779437a7ddc77f89
|
Provenance
The following attestation bundles were made for gcal_sdk_ldraney-0.1.1.tar.gz:
Publisher:
publish.yml on ldraney/gcal-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gcal_sdk_ldraney-0.1.1.tar.gz -
Subject digest:
35faac026f96c7f3385946e348d703a2408701382ebb417093303381afcfe949 - Sigstore transparency entry: 955070972
- Sigstore integration time:
-
Permalink:
ldraney/gcal-sdk@85b1873d94d029d17c6fcc9fe92f64040fcac952 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ldraney
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@85b1873d94d029d17c6fcc9fe92f64040fcac952 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gcal_sdk_ldraney-0.1.1-py3-none-any.whl.
File metadata
- Download URL: gcal_sdk_ldraney-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
663cc70d378a4b7f400a0060adcd6ce8468f792a7964d238fbb25211f64d234d
|
|
| MD5 |
a42b46fe166776a387e3b720ab623bdf
|
|
| BLAKE2b-256 |
83d8c8fdf73f4ab673c808ac45a9eebf51d3dcfe49fb644fa9b77f43a2dfde24
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gcal_sdk_ldraney-0.1.1-py3-none-any.whl -
Subject digest:
663cc70d378a4b7f400a0060adcd6ce8468f792a7964d238fbb25211f64d234d - Sigstore transparency entry: 955070994
- Sigstore integration time:
-
Permalink:
ldraney/gcal-sdk@85b1873d94d029d17c6fcc9fe92f64040fcac952 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ldraney
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@85b1873d94d029d17c6fcc9fe92f64040fcac952 -
Trigger Event:
push
-
Statement type: