@@ -0,0 +1,2630 @@
+%0Afrom __future__ import print_function%0Aimport httplib2%0Aimport os%0A%0Afrom apiclient import discovery%0Afrom oauth2client import client%0Afrom oauth2client import tools%0Afrom oauth2client.file import Storage%0A%0Aimport datetime%0A%0Atry:%0A    import argparse%0A    flags = argparse.ArgumentParser(parents=%5Btools.argparser%5D).parse_args()%0Aexcept ImportError:%0A    flags = None%0A%0A# If modifying these scopes, delete your previously saved credentials%0A# at ~/.credentials/calendar-python-quickstart.json%0ASCOPES = 'https://www.googleapis.com/auth/calendar.readonly'%0ACLIENT_SECRET_FILE = 'client_secret.json'%0AAPPLICATION_NAME = 'Google Calendar API Python Quickstart'%0A%0A%0Adef get_credentials():%0A    %22%22%22Gets valid user credentials from storage.%0A%0A    If nothing has been stored, or if the stored credentials are invalid,%0A    the OAuth2 flow is completed to obtain the new credentials.%0A%0A    Returns:%0A        Credentials, the obtained credential.%0A    %22%22%22%0A    home_dir = os.path.expanduser('~')%0A    credential_dir = os.path.join(home_dir, '.credentials')%0A    if not os.path.exists(credential_dir):%0A        os.makedirs(credential_dir)%0A    credential_path = os.path.join(credential_dir,%0A                                   'calendar-python-quickstart.json')%0A%0A    store = Storage(credential_path)%0A    credentials = store.get()%0A    if not credentials or credentials.invalid:%0A        flow = client.flow_from_clientsecrets(CLIENT_SECRET_FILE, SCOPES)%0A        flow.user_agent = APPLICATION_NAME%0A        if flags:%0A            credentials = tools.run_flow(flow, store, flags)%0A        else: # Needed only for compatibility with Python 2.6%0A            credentials = tools.run(flow, store)%0A        print('Storing credentials to ' + credential_path)%0A    return credentials%0A%0Adef main():%0A    %22%22%22Shows basic usage of the Google Calendar API.%0A%0A    Creates a Google Calendar API service object and outputs a list of the next%0A    10 events on the user's calendar.%0A    %22%22%22%0A    credentials = get_credentials()%0A    http = credentials.authorize(httplib2.Http())%0A    service = discovery.build('calendar', 'v3', http=http)%0A%0A    now = datetime.datetime.utcnow().isoformat() + 'Z' # 'Z' indicates UTC time%0A    print('Getting the upcoming 10 events')%0A    eventsResult = service.events().list(%0A        calendarId='primary', timeMin=now, maxResults=10, singleEvents=True,%0A        orderBy='startTime').execute()%0A    events = eventsResult.get('items', %5B%5D)%0A%0A    if not events:%0A        print('No upcoming events found.')%0A    for event in events:%0A        start = event%5B'start'%5D.get('dateTime', event%5B'start'%5D.get('date'))%0A        print(start, event%5B'summary'%5D)%0A%0A%0Aif __name__ == '__main__':%0A    main()%0A

Create gcal_quickstart.py