Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Max number of events? #4

Closed
sje30 opened this issue Dec 18, 2018 · 4 comments
Closed

Max number of events? #4

sje30 opened this issue Dec 18, 2018 · 4 comments

Comments

@sje30
Copy link
Contributor

sje30 commented Dec 18, 2018

Hi, thanks for this software - I hope to use it for syncing my ics file to google.

Just checking though -- are there any limitations on the number of entries that will be synced? I noticed this in the script:

   eventsResult = service.events().list(calendarId=CALENDAR_ID, timeMin=from_time, maxResults=100, singleEvents=True, orderBy='startTime', showDeleted=True).execute()

is there a hard limit of 100 events in the calendar?

@andrewramsay
Copy link
Owner

andrewramsay commented Dec 18, 2018

There shouldn't be any limits on numbers of events, but because I took some shortcuts writing the code then it could happen. The documentation for that method is here:

"maxResults: integer, Maximum number of events returned on one result page. The number of events in the resulting page may be less than this value, or none at all, even if there are more events matching the query. Incomplete pages can be detected by a non-empty nextPageToken field in the response. By default the value is 250 events. The page size can never be larger than 2500 events. Optional."

This script only retrieves upcoming events, and when I was writing it for myself I guess I picked 100 as a value for that parameter because I was sure I'd never have that many scheduled! And I clearly skimped on the logic/error handling too. The script should really be checking for incomplete pages and sending more requests until there are no more available, in which case the total number of events wouldn't matter.

Anyway it seems like it should be pretty straightforward to fix, I might get a chance to do that in the next day or two (or feel free to do it yourself, happy to merge a PR!). A shorter term "fix" would be to increase 100 to something larger, just bear in mind the API docs state you may get incomplete results...

@andrewramsay
Copy link
Owner

Just committed a quick fix in c632bd0 that I think should take care of this - I tried running it with maxResults=2 and around 20 upcoming events, and it seems to handle the multiple pages of responses OK.

@sje30
Copy link
Contributor Author

sje30 commented Dec 19, 2018

woah, thanks for the quick update. I will pull and check.

@sje30
Copy link
Contributor Author

sje30 commented Jan 4, 2019

thanks. all working fine here!

@sje30 sje30 closed this as completed Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants