def update_g_calendar_event(start_date, end_date, description, event_id): g_cal = google_calendar_api() return g_cal.update_event(calendar_id=G_CALENDAR_ID, event_id=event_id, start=start_date, end=end_date, desc=description)
from __future__ import print_function import datetime from googleapiclient.discovery import build from httplib2 import Http from oauth2client import file, client, tools from calendar_api.calendar_api import google_calendar_api m = google_calendar_api() # If modifying these scopes, delete the file token.j # If modifying these scopes, delete the file token.json. SCOPES = 'https://www.googleapis.com/auth/calendar' def main(): """Shows basic usage of the Google Calendar API. Prints the start and name of the next 10 events on the user's calendar. """ store = file.Storage('token.json') creds = store.get() if not creds or creds.invalid: flow = client.flow_from_clientsecrets('credentials.json', SCOPES) creds = tools.run_flow(flow, store) service = build('calendar', 'v3', http=creds.authorize(Http())) # Call the Calendar API now = datetime.datetime.utcnow().isoformat( ) + 'Z' # 'Z' indicates UTC time print('Getting the upcoming 10 events') events_result = service.events().list(calendarId='primary', timeMin=now, maxResults=10,
def create_g_calendar_event(start_date, end_date, description): m = google_calendar_api() return m.create_event(calendar_id=G_CALENDAR_ID, start=str(start_date) + "T00:00:00-00:00", end=str(end_date) + "T00:00:00-00:00", desc=description)