python - Google Calendar API 删除“conferenceData”嵌套对象
问题描述
编辑:这已被确定为此处的错误。
我正在尝试与新的日历活动一起制作 Google Meet。但是,由于某种原因,返回的事件不包括任何会议数据,甚至没有一个状态为失败的事件。
这是我的代码。我省略了身份验证步骤,因为我没有收到身份验证错误。
def generateMeet(emails=None, fake=False):
if emails is None:
emails = []
if fake:
return "https://www.google.com", get_random_string(10)
now = datetime.utcnow().isoformat() + 'Z' # 'Z' indicates UTC time
inonehour = (datetime.utcnow() + timedelta(hours=1)).isoformat() + 'Z'
event = {
'summary': 'Orb Meeting',
'start': {
'dateTime': now,
'timeZone': 'America/New_York',
},
'end': {
'dateTime': inonehour,
'timeZone': 'America/New_York',
},
'sendUpdates': "none",
'reminders': {
'useDefault': False,
},
'attendees': [{'email': x} for x in emails],
'conferenceDataVersion': 1,
'conferenceData': {
'createRequest': {
'requestID': get_random_string(10),
'conferenceSolutionKey': {
'type': 'hangoutsMeet'
},
}
}
}
ret = service.events().insert(calendarId='primary', body=event).execute()
return ret['conferenceData']['entryPoints'], ret['id']
这将返回一个关键错误,因为会议数据不存在。这是我运行返回之前的完整“ret”对象:
{'kind': 'calendar#event', 'etag': '"3197938620273000"', 'id': '5fb6epfe93sceba9scjt1nevsk', 'status': 'confirmed',
'htmlLink': 'https://www.google.com/calendar/event?eid=NWZiNmVwZmU5M3NjZWJhOXNjanQxbmV2c2sgZm9ycmVzdG1pbG5lckBt',
'created': '2020-09-01T14:08:30.000Z', 'updated': '2020-09-01T14:08:30.162Z', 'summary': 'Orb Meeting',
'creator': {'email': '[my email]', 'self': True},
'organizer': {'email': '[my email]', 'self': True},
'start': {'dateTime': '2020-09-01T10:08:28-04:00', 'timeZone': 'America/New_York'},
'end': {'dateTime': '2020-09-01T11:08:28-04:00', 'timeZone': 'America/New_York'},
'iCalUID': '5fb6epfe93sceba9scjt1nevsk@google.com', 'sequence': 0,
'attendees': [{'email': '[my other email]', 'displayName': 'Forrest Milner', 'responseStatus': 'needsAction'}],
'reminders': {'useDefault': False}}
谁能告诉我为什么我的请求中的会议数据部分可能会被删除?我将 ConferenceDataVersion 设置为 1,并使用随机字符串。
我尝试添加虚拟“受邀者”。在这次试验中,我邀请了我的第二个 gmail 帐户,而在其他试验中,我邀请了几个域为“example.com”的虚拟帐户。这会更新与会者,但不会显示会议数据。
我也试过等待几分钟,然后列出我所有的事件。即使在等待之后,会议数据也没有填写。当我在 GUI ( https://calendar.google.com/calendar/r ) 上查看我的日历时,它也没有附加 Google Meet。
感谢您的任何帮助。
解决方案
是的,这是一个错误,如果它是高优先级,您可以使用以下内容“修补”您创建的事件:
const eventPatch = {
conferenceData: {
createRequest: { requestId: "yourRandomString" },
},
};
let response = await calendar.events.patch({
calendarId: 'primary',
eventId: "createdEventID",
resource: eventPatch,
sendNotifications: true,
conferenceDataVersion: 1,
});
参考:https ://developers.google.com/calendar/create-events#conferencing
推荐阅读
- swiftui - SwiftUI - 在列表上居中内容
- java - EC2 Java StartInstancesRequest 从“待处理”到“停止”再到“停止”
- react-native - 构建古兰经阅读应用程序的最佳方法是什么?
- javascript - 我正在尝试使用 `.filter` 只返回数组中的字符串元素,但我不太确定该怎么做
- windows - 如何使用 Python 与 Windows 10 的 Ubuntu 终端交互?
- angular - 如何使for循环等待直到使用promises插入firebase数据库
- javascript - 仅当使用 JavaScript 聚焦特定输入时,如何显示 div 块?
- css - 从@include 生成变量
- c# - 从 Xamarin.Forms 应用程序将一组图像上传到网络核心服务器
- ssl - 尝试对 puppet 6 服务器使用 puppet 5 客户端 - ssl 错误