Last active
January 6, 2020 17:44
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It works for Google TASKS APi as well?