Skip to content

Instantly share code, notes, and snippets.

@muzizongheng
Created July 18, 2013 06:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muzizongheng/6027232 to your computer and use it in GitHub Desktop.
Save muzizongheng/6027232 to your computer and use it in GitHub Desktop.
loop to get evernote's notes
# List all of the notebooks in the user's account
notebooks = noteStore.listNotebooks(authToken)
print("Found ", len(notebooks), " notebooks:")
#calculate processed blog count currently
processedBlogCount = 0
for notebook in notebooks:
print(" * ", notebook.name)
if notebook.name != evernote.syncNotebook:
continue
filter = NoteStore.NoteFilter()
filter.notebookGuid = notebook.guid
noteCount = noteStore.findNoteCounts(authToken, filter, False).notebookCounts[notebook.guid]
print("Find note counts: %i of %s, guid is: %s"%(noteCount, notebook.name, notebook.guid))
#create blog category by tags
if evernote.isCreateTags == True:
tagslist = noteStore.listTagsByNotebook(authToken, notebook.guid)
#convert tags to categories
categories = evernote.convertTags2Category(tagslist)
try:
for c in categories:
metaweblog.new_category(c)
print("create blog's category: ", c.name)
except Exception as err:
print("Create category failed: ", err)
finally:
pass
#set note offset to loop find
nextOffset = 0
while nextOffset < noteCount:
noteList = noteStore.findNotes(authToken, filter, nextOffset, noteCount)
print("Get %i notes, currrent note offset: %i\n"%(len(noteList.notes), nextOffset))
#increase offset for next find
nextOffset += len(noteList.notes)
#print noteList
for n in noteList.notes:
print(n.title)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment