Как отправить данные календаря google в полный календарь в django?
Я хочу отправить все события календаря google в полный календарь на django. Я получил доступ ко всем событиям в google календаре пользователя после того, как он вошел в систему. Теперь мне нужно отправить эти данные в полный календарь.
def connect_google_api():
creds = None
if os.path.exists('token.json'):
creds = Credentials.from_authorized_user_file('token.json')
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file('credentials2.json',SCOPES)
creds = flow.run_local_server(port=0)
with open('token.json','w') as token:
token.write(creds.to_json())
service = build('calendar','v3',credentials=creds)
now = datetime.datetime.utcnow().isoformat()+'Z'
page_token = None
calendar_ids = []
while True:
calendar_list = service.calendarList().list(pageToken=page_token).execute()
for calendar_list_entry in calendar_list['items']:
if "myorganisation" in calendar_list_entry['id']:
calendar_ids.append(calendar_list_entry['id'])
page_token = calendar_list.get('nextPageToken')
if not page_token:
break
print(calendar_ids)
for calendar_id in calendar_ids:
count = 0
print(calendar_id)
eventsResult = service.events().list(
calendarId = calendar_id,
timeMin = now,
maxResults = 5,
singleEvents = True,
orderBy = 'startTime').execute()
events = eventsResult.get('items',[])
response = JsonResponse(events,safe=False)
if not events:
print('No upcoming events found')
print(events)
print("-----------------------------------")
Я пытаюсь понять эту документацию. Она просит меня предоставить CalendarId в формате abcd1234@group.calendar.google.com
. Я печатаю события в своем коде и не смог найти ничего в формате abcd1234@group.calendar.google.com
.
print(events)
дает что-то вроде этого
{kind:calendar#event,'etag': '"381732929101038"', 'id': 'someid', 'status': 'confirmed', 'htmlLink': 'https://www.google.com/calendar/event?eid=', 'created': '', 'updated': '', 'summary': '', 'creator': {'email': 'mail@gmail.com'}, 'organizer': {'email': 'mail@gmail.com'}, 'start': {'dateTime': '', 'timeZone': 'myzone'}, 'end': {'dateTime': 'endTime', 'timeZone': 'myzone'}, 'recurringEventId': 'someid', 'originalStartTime': {'dateTime': '', 'timeZone': ''}, 'iCalUID': '00@google.com', 'sequence': 1, 'attendees':''}
Я хочу знать, что я упускаю здесь и Как я могу отправить эти детали в FullCalendar