Subscribe to push for all Account calendars #1031
-
Erik, thanks a lot for the great library! My task is to subscribe to all the Account's calendars (now I have not found how to get them in less than two requests: I take Perhaps the easiest way to get all subscriptions is to loop through each calendar and call I found that the Please tell me how you see the best way to get subscriptions to all the user's calendars? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
A single subscription can span multiple folders. That's the purpose of Something like You're right that |
Beta Was this translation helpful? Give feedback.
A single subscription can span multiple folders. That's the purpose of
FolderCollection.subscribe_to_push()
- it will create a single subscription covering all folders in the collection.Something like
FolderCollection(account=account, folders=(account.calendar,) + tuple(account.calendar.walk())).subscribe_to_push()
should do what you want.You're right that
FolderCollection.subscribe_to_push()
returns a generator. Looking at it again, I think that's an error. I'll have it fixed asap. For now, you can just dolist(FolderCollection.subscribe_to_push())[0]
since the generator should yield only one result.