Skip to content

Commit

Permalink
Create Load.py
Browse files Browse the repository at this point in the history
  • Loading branch information
aarondls committed Feb 15, 2020
1 parent 8484975 commit 35ff6f3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Load.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Run Load.py only once for the first time to generate pickle file with the given scope

import datetime
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request

# to grant read/write access to Calendars
scopes = ['https://www.googleapis.com/auth/calendar']
credentialFile = "/Users/aarondelossantos/documents/schedulerkey/client_secret.json"

if __name__ == '__main__':
# no pickle file exists yet
if not os.path.exists('token.pickle'):
flow = InstalledAppFlow.from_client_secrets_file(
credentialFile, scopes)
creds = flow.run_console()
# Save the credentials by creating pickle file
with open('token.pickle', 'wb') as token:
pickle.dump(creds, token)

0 comments on commit 35ff6f3

Please sign in to comment.