我确实设法从我的Evernote生产帐户中获取自己的笔记。
但是,我无法获得另一个帐户与我共享的笔记。
我不知道是不是因为这些方法已被弃用,但我根本不理解。
任何帮助,示例代码或其他内容都会非常有用!!
提前致谢,
EHE
编辑:
我用来获取有人与我分享的笔记的代码如下:
def getEvernote():
authToken= "my_auth_token"
client = EvernoteClient(token=authToken, sandbox=False)
userStore = client.get_user_store()
user = userStore.getUser()
noteStore = client.get_note_store()
linked_notebooks = noteStore.listLinkedNotebooks(authToken)
shared_note_store = client.get_shared_note_store(linked_notebooks[0])
//Here, I manage to get the shared note store and the first shared notebook
updated_filter = NoteFilter(words=' ')
offset = 0
max_notes = 40000
result_spec = NotesMetadataResultSpec(includeTitle=True)
//What is shareKey???????
auth_result = shared_note_store.authenticateToSharedNotebook(shareKey, authToken)
//EDAM error
result_list = shared_note_store.findNotesMetadata(auth_result, updated_filter, offset, max_notes, result_spec)
任何帮助??
提前致谢
EHE
答案 0 :(得分:2)
看看这里:http://dev.evernote.com/doc/articles/note-sharing.php (选中"在帐户中列出所有共享笔记"部分)。
你有可以展示的代码吗?
以下是一些可以解决问题的代码:
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