我正在从服务帐户获取凭据。
SCOPES = ['https://www.googleapis.com/auth/calendar','https://www.googleapis.com/auth/calendar.events']
credentials = Credentials.from_service_account_file(path , scopes=SCOPES)
要生成见面链接,这是我的正文代码
event = {
"end": {
"dateTime": "2023-12-29T11:00:00",
"timeZone": "UTC"
},
"start": {
"dateTime": "2023-12-29T10:00:00",
"timeZone": "UTC"
},
"conferenceData": {"createRequest": {"requestId": "sample123", "conferenceSolutionKey": {"type": "hangoutsMeet"}}},
}
event_response = service.events().insert(calendarId=calendarId, body=event,conferenceDataVersion=1).execute()
我收到错误:-
returned "Invalid conference type value.". Details: "[{'domain': 'global', 'reason': 'invalid', 'message': 'Invalid conference type value.'}]">
可能存在一些与身份验证和权限有关的问题。您可以检查并确保项目上启用了 Google 日历 API。仔细检查范围(
https://www.googleapis.com/auth/calendar
和 https://www.googleapis.com/auth/calendar.events
)是否足以创建事件。