我是Evernote python 2.x API的新手,我正在研究一些例子。我设法在沙盒中创建了一个注释,但是我无法创建带附件的注释。我按照https://dev.evernote.com/doc/articles/creating_notes.php中给出的示例代码进行操作,最后调用
try:
note = noteStore.createNote(authToken, ourNote)
except Errors.EDAMUserException, edue:
## Something was wrong with the note data
## See EDAMErrorCode enumeration for error code explanation
## http://dev.evernote.com/documentation/reference/Errors.html#Enum_EDAMErrorCode
print "EDAMUserException:", edue
return None
参数ourNote打印为
Note(contentHash=None, updated=None, created=None, deleted=None, contentLength=None, title='testtitel2', notebookGuid=None, content='<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd"><en-note>testbody<br /><br />Attachment with hash 3430623163666630303562663662393263386539663366613134636630323736: <br /><en-media type="text/plain" hash="3430623163666630303562663662393263386539663366613134636630323736" /><br /></en-note>', tagNames=None, updateSequenceNum=None, tagGuids=None, active=None, attributes=None, guid=None, resources=[Resource(noteGuid=None, height=None, width=None, alternateData=None, mime='text/plain', updateSequenceNum=None, duration=None, attributes=ResourceAttributes(recoType=None, sourceURL=None, cameraMake=None, timestamp=None, altitude=None, clientWillIndex=None, longitude=None, fileName=None, attachment=None, latitude=None, applicationData=None, cameraModel=None), guid=None, data=Data(body='This is the content of testfile, aaa, bbb\\n\n', bodyHash='40b1cff005bf6b92c8e9f3fa14cf0276', size=44), active=None, recognition=None)])
我正在
EDAMUserException:EDAMUserException(errorCode = 5,parameter ='[3430623163666630303562663662393263386539663366613134636630323736]')
表示DATA_REQUIRED。到底出了什么问题?
答案 0 :(得分:0)
从错误消息中,您缺少ENML中的资源。请参阅this sample code以确保您正确处理附在笔记上的文件。
答案 1 :(得分:0)
我通过更改sample code中的第20行来解决我的问题
select * from <table name> where <last name column> = 'smith';
到
hexhash = binascii.hexlify(resource.data.bodyHash)
这使它工作。我不知道hexlify()的用途是什么。我会问Evernote家伙。我原始帖子中错误消息中的参数是&#34; hexlified&#34;哈希值。顺便说一句:为了确定身体,我使用here描述的方式。