Skip to content

Instantly share code, notes, and snippets.

@melvinkcx
Last active January 6, 2020 17:44
Show Gist options
  • Save melvinkcx/2b1dc17cf019abee48aca0718e423a0a to your computer and use it in GitHub Desktop.
Save melvinkcx/2b1dc17cf019abee48aca0718e423a0a to your computer and use it in GitHub Desktop.
Snippet for "Integrating Google Calendar (G-suite) in Node" https://hackernoon.com/my-journey-integrating-google-calendar-g-suite-in-node-62fbc8596455
from google.oauth2 import service_account
from googleapiclient.discovery import build
SCOPES = ['https://www.googleapis.com/auth/calendar']
SERVICE_ACCOUNT_FILE = './xxxxxxxxxxxx.json' # You should make it an environment variable
credentials = service_account.Credentials.from_service_account_file(SERVICE_ACCOUNT_FILE, scopes=SCOPES)
delegated_credentials = credentials.with_subject('melvin@xxxxxxxx.xx')
service = build('calendar', 'v3', credentials=delegated_credentials)
print(service.calendarList().list().execute())
@ArchTaqi
Copy link

ArchTaqi commented Jan 6, 2020

It works for Google TASKS APi as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment