Google日历API返回与API Explorer不同的结果



我正在使用Python客户端库向Google Calendar API提出请求。它可以正常工作,但是我没有在日历上获得所有事件。但是,如果我查看API资源管理器,我会以不同的格式获得所有内容。例如,API资源管理器包括我需要的"摘要"密钥。为什么是?

credentials = ServiceAccountCredentials.from_json_keyfile_name(SERVICE_ACCOUNT_JSON_FILE_PATH, scopes)
http_auth = credentials.authorize(Http())
calendar = build('calendar', 'v3', credentials=credentials)
currentTime = datetime.datetime.now()
maxTime = currentTime + relativedelta(months=+1)
#do this to get all events on this day
maxTime = maxTime.replace(minute=59, hour=23, second=59)
currentTime = currentTime.isoformat('T') + '-06:00'
maxTime = maxTime.isoformat('T') + '-06:00'
response = calendar.events().list(calendarId="*******", singleEvents=True, maxResults=2500, showHiddenInvitations=True, timeMin=currentTime, timeMax=maxTime).execute()
return JsonResponse(response)

可以在包括" summary"在内的资源表示中找到日历API资源管理器的所有属性。现在,要在成功的API请求后获取所有这些内容,请确保在Q参数中指定' * '以告诉event.list您想要完整的响应。

最新更新