0

尝试在 Python/Django 中构建与 Evernote API 连接的应用程序。对于下面的代码,我收到以下错误消息:“'Store' object has no attribute 'NoteFilter'”来自http://dev.evernote.com/documentation/reference/NoteStore.html#Svc_NoteStore可以看到,NoteFilter 是NoteStore 的属性。

def list(request):
    nbname="mihkel's notebook"
    client = EvernoteClient(token=token, sandbox=False)

    note_store = client.get_note_store()
    notebooks = note_store.listNotebooks()

    for nb in notebooks:
        if nbname == nb.name:
            nb = nb
            filter = note_store.NoteFilter()
            filter.notebookGuid = nb.guid
            notelist = note_store.findNotes(token,filter,0,10)
        break

    return render_to_response('list.html', {'nb': nb, 'notelist':notelist})
4

2 回答 2

0

解决方案:

from evernote.edam.notestore import NoteStore
....
....
def list.. :
    ...
    Filter = NoteStore.NoteFilter()
于 2013-02-10T09:20:50.327 回答
0

notestore/ttypes.py 有 NoteFilter 的定义

API代码导入中的一些示例是这样的

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

不确定这是否是一种可以接受的纠正方式,但我补充说:

import evernote.edam.notestore.ttypes as NoteStoreTypes

并像这样创建了我的过滤器:

filter = NoteStoreTypes.NoteFilter()
于 2013-03-06T16:32:04.683 回答