我刚刚设置了Evernote沙箱,并尝试练习搜索和下载详细笔记。以下是我的代码:
from evernote.api.client import EvernoteClient
from evernote.edam.notestore.ttypes import RelatedQuery, NoteFilter, NotesMetadataResultSpec
dev_token = "DEV CODE FOR SANDBOX"
client = EvernoteClient(token=dev_token, sandbox=True)
userStore = client.get_user_store()
user = userStore.getUser()
打印用户名还可以 打印(用户名) 创建新笔记就可以了 注意= ttypes.Note() note.title =“我是测试笔记!” note.content ='' note.content + ='你好,世界!' note = noteStore.createNote(note) 搜索笔记还可以:
from evernote.edam.notestore import NoteStore
filter = NoteStore.NoteFilter()
filter.words = "test"
filter.ascending = False
spec = NoteStore.NotesMetadataResultSpec()
spec.includeTitle = True
ourNoteList = noteStore.findNotesMetadata(dev_token, filter, 0, 100, spec)
for note in ourNoteList.notes:
print("{} :: {}".format(note.guid, note.title))
但是下载详细说明不是可以的:
wholeNotes = []
for note in ourNoteList.notes:
print(note.guid)
wholeNote = noteStore.getNote(dev_token, note.guid, True, False, False)
print("Content length: %d" % wholeNote.contentLength)
wholeNotes.append(wholeNote)
我收到以下错误消息: Error Msg pic 有什么建议吗?
答案 0 :(得分:0)
NoteStore.getNote需要1 guid和4布尔值。 noteStore.getNote(dev_token, note.guid, True, False, False, False)
或noteStore.getNote(note.guid, True, False, False, False)
应该适合您的情况。