Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using enno with sandbox developer token instead of oauth? #6

Open
felciano opened this issue May 25, 2020 · 4 comments
Open

Using enno with sandbox developer token instead of oauth? #6

felciano opened this issue May 25, 2020 · 4 comments

Comments

@felciano
Copy link

Is it possible to use enno with the Sandbox developer key downloaded manually from the sandbox website? The README shows how to use the oauth workflow, but the recommended workflow seems to be to not use oauth during development (see top of https://dev.evernote.com/doc/articles/dev_tokens.php)

@Jaymon
Copy link
Owner

Jaymon commented May 27, 2020

The readme might not be clear here, item 6 in the readme talks about how to use the sandbox developer token by exporting some environment variables:

export ENNO_SANDBOX=1
export ENNO_SANDBOX_ACCESS_TOKEN="<EVERNOTE_DEVELOPER_TOKEN>"

You'd set ENNO_SANDBOX_ACCESS_TOKEN to your developer token discussed in the link you shared (the token starts with S=.... Then you should be able to use enno like it is authenticated without going through any OAuth flows.

If you want to submit a pull request with clearer documentation I'd be appreciative.

@felciano
Copy link
Author

Thanks @Jaymon happy to take a swing at it.

@felciano
Copy link
Author

felciano commented May 30, 2020

@Jaymon I'm trying to expand out the README a bit more but am having difficulty getting enno working out of the gate. I have installed it with poetry but that doesn't seem to install a command-line script so the enno oauth --sandbox from the README fails (can't find the enno command).

Here is what I've tried in terms of calling the __main__ method in enno directly (failing on a call to the Captain library):

➜ poetry run python -m enno oauth --sandbox
The currently activated Python version 3.7.7 is not supported by the project (^2.7).
Trying to find and use a compatible version.
Using python2 (2.7.16)
Traceback (most recent call last):
  File "/Users/felciano/.pyenv/versions/2.7.16/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/Users/felciano/.pyenv/versions/2.7.16/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/felciano/Library/Caches/pypoetry/virtualenvs/evernote-indexer-NdlhUsf--py2.7/lib/python2.7/site-packages/enno/__main__.py", line 6, in <module>
    from captain.client import Captain
ImportError: No module named client

Could you provide an alternative that includes a full call to the python interpreter to trigger the same command, and/or a code example of launching the oauth workflow from a python function? Once I get it working I can write it up in an extended README for others.

@Jaymon
Copy link
Owner

Jaymon commented Jun 1, 2020

I've updated setup.py so it will install the enno command. I've also updated main_oauth to account for changes in the latest captain.

I don't have time to verify if anything else is out of date but I could at least get the command to open the Evernote login, so it's working on the surface.

One thing I realized as I was testing this in a Vagrant box is that the Oauth flow doesn't work if you don't have access to a browser. Not sure that can easily be accounted for either :(

Sorry for the hiccups, I wrote this code for a personal project and threw it up here but never completely finished getting it ready for other people to use or kept it up to date 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants