0

Я пытаюсь создать встречу в GMeet с помощью Python и GCalendar. Когда читал документацию, то увидел, что есть переменная, отвечающая за создание встречи, conferenceDataVersion. Я уже пытался объявлять ее в разных местах, но никак не получается. Но программа создаёт обычные события, которые без встречи.

from google.oauth2 import service_account
from googleapiclient.discovery import build

class GoogleCalendar:
    SCOPES = ['https://www.googleapis.com/auth/calendar']
    FILE_PATH = 'test_email.json'

    def __init__(self):
        credentials = service_account.Credentials.from_service_account_file(
            filename = self.FILE_PATH, scopes = self.SCOPES
        )
        self.service = build('calendar', 'v3', credentials = credentials)

    def get_calendar_list(self):
        return self.service.calendarList().list().execute()
    
    def add_calendar(self, calendar_id):
        calendar_list_entry = {
            'id': calendar_id
        }
        return self.service.calendarList().insert(
            body = calendar_list_entry).execute()
    
    def add_event(self, calendar_id, body):
        return self.service.events().insert(
            calendarId = calendar_id, 
            body = body).execute()


obj = GoogleCalendar()
calendar = 'my_email@gmail.com'

# Данная функция используется единожды
"""
obj.add_calendar(
    calendar_id = 'my_email@gmail.com'
)
"""

# Добавить событие
event = {
    'summary': 'Example Event',
    'start': {
        'dateTime': '2023-05-26T09:00:00-07:00',
        'timeZone': 'America/Los_Angeles',
    },
    'end': {
        'dateTime': '2023-05-26T17:00:00-07:00',
        'timeZone': 'America/Los_Angeles',
    },
    'conferenceData': {
        'createRequest': {
            'conferenceSolutionKey': {
                'type': 'hangoutsMeet'
            },
            'requestId': 'your_unique_request_id'
        },
        'conferenceDataVersion': 1
    }
}

event = obj.add_event(calendar_id = calendar, body = event)

0

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Посмотрите другие вопросы с метками или задайте свой вопрос.