def buildCalendarDataGAPIObject(calname): calendarId = normalizeCalendarId(calname) # Force service account token request. If we fail fall back to using # admin for authentication cal = __main__.buildGAPIServiceObject('calendar', calendarId, False) if cal is None: _, cal = buildCalendarGAPIObject(__main__._getValueFromOAuth('email')) return (calendarId, cal)
def buildCalendarDataGAPIObject(calname): calendarId = normalizeCalendarId(calname) # Try to impersonate the calendar owner. If we fail, fall back to using # admin for authentication. Resource calendars cannot be impersonated, # so we need to access them as the admin. cal = None if not calname.endswith('.calendar.google.com'): cal = __main__.buildGAPIServiceObject('calendar', calendarId, False) if cal is None: _, cal = buildCalendarGAPIObject(__main__._getValueFromOAuth('email')) return (calendarId, cal)
def buildCalendarGAPIObject(calname): calendarId = normalizeCalendarId(calname) return (calendarId, __main__.buildGAPIServiceObject('calendar', calendarId))