-
-
Save ciiqr/11195434 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getAllSharedNotes(authToken, noteStore, maxCount=None): | |
noteFilter = NoteStore.NoteFilter() | |
noteFilter.words = "sharedate:*" | |
sharedNotes = [] | |
offset = 0 | |
if not maxCount: | |
maxCount = 500 | |
while len(sharedNotes) < maxCount: | |
try: | |
noteList = noteStore.findNotes(authToken, noteFilter, offset, 50) | |
sharedNotes += noteList.notes | |
except (EDAMNotFoundException, EDAMSystemException, EDAMUserException), e: | |
print "Error getting shared notes:" | |
print type(e), e | |
return None | |
if len(sharedNotes) % 50 != 0: | |
## We've retrieved all of the notes | |
break | |
else: | |
offset += 50 | |
return sharedNotes[:maxCount] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment