evernote / evernote-sdk-python3 Goto Github PK
View Code? Open in Web Editor NEWTesting the Evernote Cloud API for Python 3
License: Other
Testing the Evernote Cloud API for Python 3
License: Other
Hello,
I am in no way an expert of web APIs etc, but after a github code search I concluded that this might be an issue.
I was writing a small python script that used this v3 API and got to the point in which I needed to use NoteStore.getNote
to retrieve the content of a note. I read that the method has been deprecated in favor of NoteStore.getNoteWithResultSpec
. However, the latter requires an object of type NoteResultSpec
to set which properties to retrieve but I could not find a way to create such an object, NoteStore.NoteResultSpec()
did not work, for example.
Am I missing something?
I've had a long running job using the evernote python 3 API. It suddenly stopped working today. I am seeing the following errors:
Traceback (most recent call last):
File "EDAMTest.py", line 49, in <module>
UserStoreConstants.EDAM_VERSION_MINOR
File "/Users/xxxxx/Applications/miniconda3/envs/xxxxx/lib/python3.7/site-packages/evernote/api/client.py", line 161, in delegate_method
return targetMethod(*args, **kwargs)
File "/Users/xxxxx/Applications/miniconda3/envs/xxxxx/lib/python3.7/site-packages/evernote/edam/userstore/UserStore.py", line 491, in checkVersion
return self.recv_checkVersion()
File "/Users/xxxxx/Applications/miniconda3/envs/xxxxx/lib/python3.7/site-packages/evernote/edam/userstore/UserStore.py", line 504, in recv_checkVersion
(fname, mtype, rseqid) = self._iprot.readMessageBegin()
File "/Users/xxxxx/Applications/miniconda3/envs/xxxxx/lib/python3.7/site-packages/thrift/protocol/TBinaryProtocol.py", line 145, in readMessageBegin
type = self.readByte()
File "/Users/xxxxx/Applications/miniconda3/envs/xxxxx/lib/python3.7/site-packages/thrift/protocol/TBinaryProtocol.py", line 201, in readByte
val, = unpack('!b', buff)
struct.error: unpack requires a buffer of 1 bytes
Digging around random stack traces show that :
> /Users/xxxxx/Applications/miniconda3/envs/xxxxx/lib/python3.7/site-packages/thrift/protocol/TBinaryProtocol.py(145)readMessageBegin()
-> type = self.readByte()
(Pdb) l
140 else:
141 if self.strictRead:
142 raise TProtocolException(type=TProtocolException.BAD_VERSION,
143 message='No protocol version header')
144 name = self.trans.readAll(sz)
145 -> type = self.readByte()
(Pdb) name
b'ctype html><html lang="en"><head><title>HTTP Status 400 \xe2\x80\x93 Bad Request</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 400 \xe2\x80\x93 Bad Request</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Description</b> The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).</p><hr class="line" /><h3>Apache Tomcat/8.5.54</h3></body></html>'
Is the API no longer worker or deprecated?
When I try to create a note, I give the consumer key and so on, but with Python 3.5 we got this error .
self.note_store = self.client.get_note_store()
File "lib/evernote/api/client.py", line 70, in get_note_store
note_store_uri = user_store.getNoteStoreUrl()
File "lib/evernote/api/client.py", line 131, in delegate_method
)(**dict(list(zip(arg_names, args))))
File "lib/evernote/edam/userstore/UserStore.py", line 1155, in getNoteStoreUrl
self.send_getNoteStoreUrl(authenticationToken)
File "lib/evernote/edam/userstore/UserStore.py", line 1164, in send_getNoteStoreUrl
self._oprot.trans.flush()
File "lib/thrift/transport/THttpClient.py", line 108, in _f
result = f(*args, **kwargs)
File "lib/thrift/transport/THttpClient.py", line 139, in flush
self.__http.putheader(key, val)
File "/opt/python-3.5/lib/python3.5/http/client.py", line 1060, in putheader
raise ValueError('Invalid header value %r' % (values[i],))
ValueError: Invalid header value b'<my_consumer_key>:V=2 / 1.25; Python / 3.5.1 (default, May 23 2016, 09:21:16) \n[GCC 4.9.2];'
This works in Python 3.4.
But since 3.5 there is a new check:
if _is_illegal_header_value(values[i]):
raise ValueError('Invalid header value %r' % (values[i],))
python3 EDAMTest.py
Traceback (most recent call last):
File "EDAMTest.py", line 41, in
UserStoreConstants.EDAM_VERSION_MINOR
File "/usr/local/lib/python3.4/site-packages/evernote-1.25.0-py3.4.egg/evernote/api/client.py", line 125, in delegate_method
File "/usr/local/lib/python3.4/site-packages/evernote-1.25.0-py3.4.egg/evernote/edam/userstore/UserStore.py", line 491, in checkVersion
File "/usr/local/lib/python3.4/site-packages/evernote-1.25.0-py3.4.egg/evernote/edam/userstore/UserStore.py", line 504, in recv_checkVersion
File "/usr/local/lib/python3.4/site-packages/evernote-1.25.0-py3.4.egg/thrift/protocol/TBinaryProtocol.py", line 144, in readMessageBegin
File "/usr/local/lib/python3.4/site-packages/evernote-1.25.0-py3.4.egg/thrift/transport/THttpClient.py", line 99, in readAll
File "/usr/local/lib/python3.4/site-packages/evernote-1.25.0-py3.4.egg/thrift/transport/THttpClient.py", line 96, in read
File "/usr/local/lib/python3.4/http/client.py", line 500, in read
return super(HTTPResponse, self).read(amt)
MemoryError
export PYTHONPATH=../lib; python3 EDAMTest.py
Traceback (most recent call last):
File "EDAMTest.py", line 41, in
UserStoreConstants.EDAM_VERSION_MINOR
File "/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/evernote-1.25.0-py3.3.egg/evernote/api/client.py", line 125, in delegate_method
File "/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/evernote-1.25.0-py3.3.egg/evernote/edam/userstore/UserStore.py", line 491, in checkVersion
File "/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/evernote-1.25.0-py3.3.egg/evernote/edam/userstore/UserStore.py", line 504, in recv_checkVersion
File "/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/evernote-1.25.0-py3.3.egg/thrift/protocol/TBinaryProtocol.py", line 145, in readMessageBegin
File "/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/evernote-1.25.0-py3.3.egg/thrift/protocol/TBinaryProtocol.py", line 201, in readByte
struct.error: unpack requires a bytes object of length 1
I can't create dev token anymore?
I get following message:
Update: the creation of developer tokens is temporarily disabled.
So how do I authorize ?
filter = SyncChunkFilter(includeNotes=True, notebookGuids=notebookGuids)
TypeError: __init__() got an unexpected keyword argument 'notebookGuids'
notebookGuids
is a valid argument according to the documentation.
We only need it to be robust. It doesn't have to contain every feature of the APIs.
We want to be able to integrate it with pip.
I'm trying to run note_store.findNotesMetadata
but there doesn't seem to be a way to add a filter.
In [78]: note_store.NoteFilter
Out[78]: <function evernote.api.client.Store.__getattr__.<locals>.delegate_method(*args, **kwargs)>
In [79]: note_store.NoteFilter()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-79-083965d2832e> in <module>
----> 1 note_store.NoteFilter()
~/anaconda3/envs/py36/lib/python3.6/site-packages/evernote/api/client.py in delegate_method(*args, **kwargs)
155 targetMethod = getattr(self._client, name, None)
156 if targetMethod is None:
--> 157 return object.__getattribute__(self, name)(*args, **kwargs)
158
159 org_args = inspect.getargspec(targetMethod).args
AttributeError: 'Store' object has no attribute 'NoteFilter'
Could someone please give me some advice, or provide an estimate for when this could get resolved. Thanks!
Hi,
The Python 2.7 EOL is quickly approaching, and I noticed that there hasn't been any work on this repo in the last 2 years. So I just wanted to confirm what I fear that this SDK won't be released before the end of the year?
It's unfortunate as I'm working on an application that has an in integration with Evernote that we'll have to sunset as a result.
Thanks in advance for any timeline updates you can share!
Hi, I've noticed that the sdk for python2 includes a version of THttpClient that supports proxies while this one does not explicitly offer this.
Is there a workaround? Are you planning to update this?
So, I have a next note XML rendered in my application (the telenote_api
prefix is just a name of my docker container):
telenote_api | <?xml version="1.0" encoding="UTF-8"?>
telenote_api | <!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">
telenote_api | <en-note>
telenote_api | Видеокурс по разработке на Python
telenote_api |
telenote_api | Прошедшей осенью в московском офисе Яндекса проходила первая Школа бэкенд-разработки по теме промышленной разработки на Python.
telenote_api |
telenote_api | Теперь эти уроки выложены в открытом доступе и пройти их может каждый. К каждому видео приложены ссылки на примеры и полезные материалы:
telenote_api |
telenote_api | https://tprg.ru/t4e9
telenote_api |
telenote_api | #python
telenote_api |
telenote_api | <en-media type="image/jpeg"
telenote_api | hash="6a4152d7c4e4fdfcf1b2b058fb88a05c"/>
telenote_api |
telenote_api | </en-note>
But when the note is craeted the picture is not presented in it:
Am I doint right? Note, that I'm currently using Evernote sandbox (dev) server.
The generated User-Agent will not parse the validation of httpclient.
It generated such a "User-Agent" for me: b'en-devtoken:V=2 / 1.25; Python / 3.5.1 (v3.5.1:37a07cee5969, Dec 5 2015, 21:12:44) \n[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)];'
And an error was raised at "File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1060, in putheader" since function _is_illegal_header_value() says it is an invalid user agent.
I am running python3.5.1 on Mac OS inside an django app whose version is 1.9.
On MacOS Catalina 10.15.6, running pip3 install evernote
breaks, with the following error -
ERROR: Command errored out with exit status 1:
command: /Users/xxxx/repos/myApp/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/n9/m6n13sk51w96h38mxqhfltm40000gn/T/pip-install-0yy4k5tr/evernote/setup.py'"'"'; file='"'"'/private/var/folders/n9/m6n13sk51w96h38mxqhfltm40000gn/T/pip-install-0yy4k5tr/evernote/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/n9/m6n13sk51w96h38mxqhfltm40000gn/T/pip-pip-egg-info-rsude9sr
cwd: /private/var/folders/n9/m6n13sk51w96h38mxqhfltm40000gn/T/pip-install-0yy4k5tr/evernote/
Complete output (6 lines):
Traceback (most recent call last):
File "", line 1, in
File "/private/var/folders/n9/m6n13sk51w96h38mxqhfltm40000gn/T/pip-install-0yy4k5tr/evernote/setup.py", line 6
exec x
^
SyntaxError: Missing parentheses in call to 'exec'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
When I try to log a captured EDAMUserException using the python standard logging system, the logging system raises a new exception because is unable to handle EDAMUserException.
Internally the logging system is calling traceback to print the exception, but traceback fails.
This is the line of code that generates the exception when printing EDAMUserException.
traceback.print_exception(ei[0], ei[1], tb, None, sio)
I also attach a related traceback.
/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/init.py:1310: in exception
self.error(msg, _args, *_kwargs)
/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/init.py:1303: in error
self._log(ERROR, msg, args, **kwargs)
/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/init.py:1409: in _log
self.handle(record)
/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/init.py:1419: in handle
self.callHandlers(record)
/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/init.py:1481: in callHandlers
hdlr.handle(record)
/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/init.py:853: in handle
self.emit(record)
/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/init.py:1041: in emit
StreamHandler.emit(self, record)
/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/init.py:984: in emit
self.handleError(record)
/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/init.py:906: in handleError
traceback.print_exception(t, v, tb, None, sys.stderr)
/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py:169: in print_exception
for line in _format_exception_iter(etype, value, tb, limit, chain):
/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py:146: in _format_exception_iter
for value, tb in values:
/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py:138: in _iter_chain
yield from it
/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py:138: in _iter_chain
yield from it
/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py:138: in _iter_chain
yield from it
/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py:138: in _iter_chain
yield from it
/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py:138: in _iter_chain
yield from it
/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py:138: in _iter_chain
yield from it
exc = TypeError("unhashable type: 'EDAMUserException'",), custom_tb = None
seen = set([TypeError("unhashable type: 'EDAMUserException'",), TypeError("unhashable type: 'EDAMUserException'",), TypeError...tion'",), TypeError("unhashable type: 'EDAMUserException'",), TypeError("unhashable type: 'EDAMUserException'",), ...])
def _iter_chain(exc, custom_tb=None, seen=None):
if seen is None:
seen = set()
seen.add(exc)
its = []
context = exc.__context__
cause = exc.__cause__
if cause is not None and cause not in seen:
its.append(_iter_chain(cause, False, seen))
its.append([(_cause_message, None)])
elif (context is not None and
not exc.__suppress_context__ and
context not in seen):
E TypeError: unhashable type: 'EDAMUserException'
/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py:132: TypeError
I have upgraded to Python 3.11.1. Now I get the following error:
....python3.11/site-packages/evernote3-1.25.0-py3.11.egg/evernote/api/client.py", line 159, in delegate_method
AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?
will a new evernote SDK be available in the near future?
I receive the following error message:
"""
{"errno":-3008,"code":"ENOTFOUND","syscall":"getaddrinfo","hostname":"sandbox.evernote.com"}
"""
It seems the following command:
export PYTHONPATH=../lib; python EDAMTest.py
Should be:
export PYTHONPATH=../../lib; python EDAMTest.py
A few markdowns around file paths and commands could also help.
Hi,
I use evernote-python-sdk3 to develop a app, run in debug mode is ok. But, when i use cx_freeze to make a setup exe, it run error.
call stack like this:
"xxxx\build\exe.win-amd64-3.7\lib\evernote\api\client.py", line 6, in
import oauth2 as oauth
File "D:\python37\lib\site-packages\oauth2_init_.py", line 31, in
import httplib2
File "D:\python37\lib\site-packages\httplib2_init_.py", line 40, in
import ssl
File "D:\python37\lib\ssl.py", line 98, in
import _ssl #if we can't import it, let the error propagate
ImportError: DLL load failed:
So #10 fix no more works.
The code is simple -
filter = evernote.edam.notestore.ttypes.NoteFilter()
filter.ascending = False
spec = evernote.edam.notestore.ttypes.NotesMetadataResultSpec()
spec.includeTitle = True
notes = note_store.findNotesMetadata(filter, 0, 250, spec)
python binary dies with triple '--- Logging error ---' in both Linux and MacOS.
It seems that Thrift generates calls to the (pre Python3) method iteritems() on dictionaries (as seen in file ttypes.py:825 and in some other locations in this file).
This method is not available in Python3 and throws errors when one tries to deserialize an object returned by the Evernote API, e.g. when running something like this (using modified code from the EDAMtest.py example):
noteStoreHttpClient = THttpClient.THttpClient(noteStoreUrl)
noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient)
noteStore = NoteStore.Client(noteStoreProtocol)
tags = noteStore.listTags(authToken)
print(tags)
If you change all iteritems() calls in ttypes.py to items(), it works as expected.
As ttypes.py is auto-generated, I think this calls for changes in Thrift itself, right?
In line 138 of thrift.THttpClient.py there is a call to iteritems(), which will not work in Python 3.x
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.