0
我已經寫了一小段代碼,將我的筆記標記名稱追加到標題,然後刪除所有相關的標籤。當我嘗試在生產環境中運行時,我很快達到了速率限制。有人可以幫我優化這段代碼嗎?或者我應該要求Evernote提供特殊的費率限制嗎?的Evernote的Python API - 命中率限制
另外,我得到一個錯誤,當一個音符沒有標記。沒有辦法有效地從一個音符獲得標籤的數量,所以我沒有得到這個錯誤嗎?
from evernote.api.client import EvernoteClient
from evernote.edam.notestore import NoteStore
dev_token = "dev_token"
client = EvernoteClient(token=dev_token, sandbox = False)
userStore = client.get_user_store()
user = userStore.getUser()
print
print user.username
print
noteStore = client.get_note_store()
notebooks = noteStore.listNotebooks()
for n in notebooks:
print "Notebook = " + n.name + " GUID = " + n.guid
filter = NoteStore.NoteFilter()
filter.ascending = False
filter.notebookGuid=n.guid
spec = NoteStore.NotesMetadataResultSpec()
spec.includeTitle = True
spec.includeNotebookGuid = True
spec.includeTagGuids = True
notesMetadataList = noteStore.findNotesMetadata(filter, 0, 25, spec)
for noteMetadata in notesMetadataList.notes:
print "%s :: %s" % (noteMetadata.title, noteMetadata.guid)
newNoteTitle = noteMetadata.title + " -- "
for tagGuid in noteMetadata.tagGuids:
tag = noteStore.getTag(tagGuid)
tagName = tag.name
print tagName
newNoteTitle = newNoteTitle + " " + tagName
print "newNoteTitle = " + newNoteTitle
noteMetadata.title = newNoteTitle
noteMetadata.tagGuids = []
noteMetadata = noteStore.updateNote(noteMetadata)
print noteMetadata.title
如何定義'evernote_wait_try_again'? – jwodder
固定。見https://github.com/rdhyee/evernote-web-utility/blob/0.0.6/EvernoteWebUtil/__init__.py#L55-L80在上下文中。 –