Skip to content

Instantly share code, notes, and snippets.

@Laurent-Sarrazin
Created April 17, 2014 11:54
Show Gist options
  • Save Laurent-Sarrazin/10977350 to your computer and use it in GitHub Desktop.
Save Laurent-Sarrazin/10977350 to your computer and use it in GitHub Desktop.
Get shared notes with the evernote api
import evernote.edam.notestore.NoteStore as NoteStore
from evernote.api.client import EvernoteClient
from evernote.api.client import Store
from evernote.edam.notestore.ttypes import NoteFilter, NotesMetadataResultSpec
auth_token = "YOUR TOKEN"
client = EvernoteClient(token=auth_token, sandbox=True)
noteStore = client.get_note_store()
# get linked notebooks
linked_notebooks = noteStore.listLinkedNotebooks(auth_token)
linked_notebook = linked_notebooks[0]
# shareKey for the first notebook
shareKey = linked_notebook.shareKey
# get the right noteStore
note_store_uri = linked_notebook.noteStoreUrl
shared_note_store = Store(auth_token, NoteStore.Client, note_store_uri)
# authenticate to the linked notebook
auth_result = shared_note_store.authenticateToSharedNotebook(shareKey,auth_token)
# get the share token
share_token = auth_result.authenticationToken
updated_filter = NoteFilter(words=' ')
offset = 0
max_notes = 40000
result_spec = NotesMetadataResultSpec(includeTitle=True)
result_list = shared_note_store.findNotesMetadata(share_token, updated_filter, offset, max_notes, result_spec)
print result_list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment