Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Async Google Calendar API Client

Project description

aiogc

Async Google Calendar API Client for Python 3

Installation

Run this in your terminal:

pip install aiogc

Usage

Following code prints summary and start and end datetimes of upcoming events within nearest 5 days.

import asyncio
import datetime

import aiohttp

from aiogc import events, models

c = models.Credentials(
	client_id='<your_client_id>',
    client_secret='<your_client_secret>',
    scopes=['<your_scope1>', 'your_scope2'],
    refresh_token='<your_refresh_token>'
)

async def main():
	async with aiohttp.ClientSession() as s:
		es = await events.list(
			calendar_id='<your_calendar_id>',
			credentials=c,
			session=s,
			singleEvents='true',
			timeMin=datetime.datetime.now().isoformat(),
			timeMax=(datetime.datetime.now() + datetime.timedelta(days=5)).isoformat(),
			orderBy='startTime',
		)
		for e in es:
			print(f'{e.summary}:\n{e.start.dateTime}{e.end.dateTime}')

if __name__=='__main__':
	loop = asyncio.get_event_loop()
	loop.run_until_complete(main())

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
aiogc-0.1.5-py3-none-any.whl (6.0 kB) Copy SHA256 hash SHA256 Wheel py3
aiogc-0.1.5.tar.gz (3.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page