python-caldav / caldav

Apache License 2.0
313 stars 91 forks source link

507 error during collection sync #340

Open siderai opened 8 months ago

siderai commented 8 months ago

Calling calendar_principal.calendar(name=calendar_name).objects(load_objects=False) for google calendar and yandex calendar somehow raises the following error: caldav.lib.error.ResponseError: ResponseError at 'HTTP/1.1 507 Insufficient Storage', reason no reason. Some accounts or particular calendars raise this error consistently, others do not at all, and I don't understand why.

I haven't found any documented solutions neither at the platforms nor within the library.

I get that 5** status code indicates a server-side problem, but is there anything I can do client-side to prevent this from happening?

Any ideas on how to handle it?

tobixen commented 8 months ago

I'm intending to create some frameworks for letting the library work around known incompatibility-issues.

There are different pathways to fetching all objects on a calendar, if I remember correct the .objects will do a sync-token request. At the other hand you have .events() and .todos() which will search for events and tasks. If the first doesn't work out, then try the latter.

siderai commented 8 months ago

objects() returns a SynchronizableCalendarObjectCollection, which allows you to get periodic updates on events without storing them locally (sync() method). So querying by sync token is preferable. I don't need to get all the events in the query, but only a snapshot and then updates later on.

I like this mechanism, but I'm concerned about an incompatibility occurring here and there.

Where do you think the root of the problem is: in the library implementation or in google services? In the first case we can think of a workaround, but in the second case I can only put up with it or use another version of google calendar API.

tobixen commented 8 months ago

I'm not quite sure where the problem is. It's been a long time since I tested the library against Google, and there is nothing in my notes that it didn't support sync token. There is also a link in the documentation towards https://developers.google.com/calendar/caldav/v2/guide - and on that link it says clearly that rfc6578 should be supported - and that is the sync-token standard. So it seems like it should work, I don't know what could be wrong.

I do have a Google account, so theoretically I should be able to check this up myself - but I don't think I will have any time this week nor the next.