Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_todos(auth_token):
- client = EvernoteClient(token=auth_token)
- note_store = client.get_note_store()
- # search for notes which have #todo content
- # see http://dev.evernote.com/doc/articles/search.php
- notefilter = NoteStore.NoteFilter()
- notefilter.words = '#todo'
- spec = NoteStore.NotesMetadataResultSpec()
- spec.includeTitle = True
- note_list = note_store.findNotesMetadata(auth_token, notefilter, 0, 100, spec)
- print 'Search for #todo found %d notes' % note_list.totalNotes
- # for each note, pull the #todo lines
- todos = []
- for note_search_result in note_list.notes:
- # pull note content
- note = note_store.getNote(
- auth_token,
- note_search_result.guid,
- True,
- False,
- False,
- False,
- )
- # find <li>'s with #todo text and print
- tree = ET.fromstring(note.content)
- elems = tree.findall('.//li')
- todo_elems = filter(lambda e: '#todo' in e.text, elems)
- for elem in todo_elems:
- s = '%s :: %s' % (note_search_result.title, elem.text)
- print s
- todos.append(s)
- return todos
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement