From b99a463afb05912837e6a7f583924b843ed5982f Mon Sep 17 00:00:00 2001 From: Phong Date: Thu, 9 Nov 2023 01:18:49 -0600 Subject: [PATCH] Change top to 400 --- IndividualCalendar.py | 2 +- SharedCalendar.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/IndividualCalendar.py b/IndividualCalendar.py index 30a9644..04e4f20 100644 --- a/IndividualCalendar.py +++ b/IndividualCalendar.py @@ -206,5 +206,5 @@ def process_individual_calendars(calendar, start_date, end_date): except KeyError as e: logger.warning(f"Unable to find: " + net_id) - # filtered_events = [] + #filtered_events = [] return filtered_events diff --git a/SharedCalendar.py b/SharedCalendar.py index 83fb918..0187fdd 100644 --- a/SharedCalendar.py +++ b/SharedCalendar.py @@ -80,7 +80,7 @@ def get_shared_calendar(shared_calendar_id, start_date, end_date, access_token): # start between start_date and end_date (includes start_date) # The exception is if the event start on the end_date. That event will not be included in the response.json() - endpoint = 'https://graph.microsoft.com/v1.0/me/calendars/' + shared_calendar_id +'/events?$select=subject,body,start,end,showAs&$top=100&$filter=start/dateTime ge ' + '\''+ start_date + '\'' + ' and start/dateTime lt ' + '\'' + end_date + '\'' + endpoint = 'https://graph.microsoft.com/v1.0/me/calendars/' + shared_calendar_id +'/events?$select=subject,body,start,end,showAs&$top=400&$filter=start/dateTime ge ' + '\''+ start_date + '\'' + ' and start/dateTime lt ' + '\'' + end_date + '\'' response = requests.get(endpoint, headers=header) if (response.status_code != 200): @@ -144,6 +144,8 @@ def update_shared_calendar(individual_calendars, shared_calendar, event_ids, sha events_to_add = individual_events.difference(shared_events) events_to_delete = shared_events.difference(individual_events) + + logger.debug(f"Number of events to be added: {len(events_to_add)}") batches = create_batches_for_adding_events(events_to_add, access_token, shared_calendar_id, category_name, category_color) post_batch(access_token, batches)