Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
GoogleCalendar
✓ from gcsa.google_calendar import GoogleCalendar
✗ from gcsa import GoogleCalendar
GoogleCalendar is not at top-level package
Event
✓ from gcsa.event import Event
✗ from gcsa import Event
Event class is in submodule
Recurrence
✓ from gcsa.recurrence import Recurrence
✗ from gcsa import Recurrence
Recurrence is not imported at package root
Creates a calendar instance, adds a sample event, and lists all events.
import os
from gcsa.google_calendar import GoogleCalendar
from gcsa.event import Event
# Replace with your credentials file path or use environment variable
CREDENTIALS_PATH = os.environ.get('GCAL_CREDENTIALS', 'credentials.json')
# Initialize calendar (default: primary)
gcal = GoogleCalendar(credentials_path=CREDENTIALS_PATH)
# Create an event
event = Event(
summary='Test Event',
start='2026-07-01T10:00:00',
end='2026-07-01T11:00:00',
timezone='America/New_York'
)
gcal.add_event(event)
# List events
for e in gcal.get_events():
print(e.summary, e.start, e.end)
Errors
Common errors & fixes
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://www.googleapis.com/calendar/v3/calendars/primary/events
Often caused by invalid or expired credentials, or the calendar ID is wrong.
fixRegenerate credentials.json from Google Cloud Console, ensure the Calendar API is enabled, and use correct calendar ID.
google.auth.exceptions.RefreshError: ('invalid_grant: Bad Request', {'error': 'invalid_grant'})
The refresh token has expired or the credentials file is outdated.
fixDelete the token.pickle file (or cache) and re-authenticate by running the script again.
Upgrade
Version history
2.6.0latest on PyPI · released Aug 22, 2025
Audit
Dependencies
google-api-python-clientrequiredRequired for Google API interaction
google-auth-oauthlibrequiredOAuth2 authentication flow
google-auth-httplib2requiredHTTP transport for google-auth