import evernote.edam.type.ttypes as Types
import evernote.edam.notestore.ttypes as NTypes

from evernote.api.client import EvernoteClient

class NoteService():
    def __init__(self, dev_token):
    	if dev_token is not None:
            self.dev_token = dev_token
            self.client = EvernoteClient(token=self.dev_token)
        else:
            raise Error

    def connect(self):
        userStore = self.client.get_user_store()
        user = userStore.getUser()
        return user.username

    def prepareNotebook(self):
        note_store = self.client.get_note_store()
        notebooks = note_store.listNotebooks()
        l = []
        for n in notebooks:
            if n.name == 'evergtd':
                return n.guid
        notebook = Types.Notebook()
        notebook.name = 'evergtd'
        notebook = note_store.createNotebook(notebook)
        return notebook.guid

    def prepareNotes(self, notebookGuid):
        note_filter = NTypes.NoteFilter(notebookGuid=notebookGuid)
        result_spec = NTypes.NotesMetadataResultSpec(includeTitle=True, includeNotebookGuid=True)
        note_store = self.client.get_note_store()
        meta_list = note_store.findNotesMetadata(note_filter, 0, 4, result_spec)
        return meta_list.totalNotes()

if __name__ == '__main__':
    dev_token = "S=s1:U=8fcf8:E=150da644ca6:C=14982b31da8:P=1cd:A=en-devtoken:V=2:H=a8defc28f091744b9ebfaea80f5c1d58"
    ns = NoteService(dev_token)
    print ns.prepareNotes(ns.prepareNotebook)

@@ -232,24 +232,25 @@
        self.
+_
 dev_token = 
@@ -272,24 +272,25 @@
        self.
+_
 client = Eve
@@ -312,16 +312,17 @@
 en=self.
+_
 dev_toke
@@ -320,24 +320,76 @@
 _dev_token)%0A
+            self._note_names = %5B%221%22, %222%22, %223%22, %224%22%5D%0A
         else
@@ -455,32 +455,33 @@
 serStore = self.
+_
 client.get_user_
@@ -602,32 +602,33 @@
 te_store = self.
+_
 client.get_note_
@@ -988,16 +988,68 @@
 kGuid):%0A
+        note_store = self._client.get_note_store()%0A%0A
         
@@ -1080,16 +1080,38 @@
 eFilter(
+)%0A        note_filter.
 notebook
@@ -1114,17 +1114,19 @@
 bookGuid
-=
+ = 
 notebook
@@ -1129,17 +1129,16 @@
 bookGuid
-)
 %0A       
@@ -1232,58 +1232,8 @@
 ue)%0A
-        note_store = self.client.get_note_store()%0A
     
@@ -1309,16 +1309,49 @@
 t_spec)%0A
+%0A        for meta in meta_list:%0A%0A
         
@@ -1377,18 +1377,16 @@
 talNotes
-()
 %0A%0Aif __n
@@ -1552,24 +1552,24 @@
 (dev_token)%0A
-
     print ns
@@ -1596,14 +1596,16 @@
 pareNotebook
+()
 )%0A

add preparenotes