Skip to content

Commit

Permalink
use oauth (add app engine server)
Browse files Browse the repository at this point in the history
major refactor
works with current evernote
  • Loading branch information
dvj committed Aug 30, 2015
1 parent 781ab2b commit 63fa4d3
Show file tree
Hide file tree
Showing 9 changed files with 448 additions and 802 deletions.
14 changes: 0 additions & 14 deletions README
Expand Up @@ -4,19 +4,5 @@ Author: dvj (Doug Johnston)

Evernote is a cross platform note taking system. They have GUI clients for Windows and Mac, various mobile platforms, and a web client. I still prefer doing most of my quick work from the command line, so here's an implementation of a command line client.

Requirements:
You need to have the Evernote API code and Thrift code in your PYTHONPATH, which you can get from http://www.evernote.com/about/developer/api/

You'll also need to sign up for an Evernote API key which you can get from the same page. After signing up for an account you'll get a Consumer_key and a consumer_secret from Evernote (I think they use a manual process, so be a bit patient). You'll need to put these into the top of the clevernote.py file for things to work.

Next you'll need to make an Evernote account on their dev server, at http://sandbox.evernote.com/

Finally (!), you're ready to use the script. Enter your account info when prompted, and you should have access to your notes from the command line. Yey!

Hopefully, after this gets a little more mature it can go through some process to be able to access the regualr evernote service (not the dev service) and work for everyone.



About:
The client currently uses markdown (http://daringfireball.net/projects/markdown/) to handle notes with rich text. Obviously pictures and media dont come across too well though :P

17 changes: 17 additions & 0 deletions clevernote-web-auth/clevernote-cli/app.yaml
@@ -0,0 +1,17 @@
application: clevernote-cli
version: 2
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico

- url: .*
script: main.app

libraries:
- name: webapp2
version: "2.5.2"
12 changes: 12 additions & 0 deletions clevernote-web-auth/clevernote-cli/index.yaml
@@ -0,0 +1,12 @@
indexes:

# AUTOGENERATED

# This index.yaml is automatically updated whenever the dev_appserver
# detects that a new type of query is run. If you want to manage the
# index.yaml file manually, remove the above marker line (the line
# saying "# AUTOGENERATED"). If you want to manage some indexes
# manually, move them above the marker line. The index.yaml file is
# automatically uploaded to the admin console when you next deploy
# your application using appcfg.py.

35 changes: 35 additions & 0 deletions clevernote-web-auth/clevernote-cli/main.py
@@ -0,0 +1,35 @@
#!/usr/bin/env python

import base64
import pickle
import webapp2
import cgi


class MainHandler(webapp2.RequestHandler):
def get(self):
self.response.write('')


class OAuthHandler(webapp2.RequestHandler):
def get(self):
token = self.request.get('oauth_token')
verifier = self.request.get('oauth_verifier')
auth_dict = {'token': token, 'verifier': verifier}
data = pickle.dumps(auth_dict)
data64 = base64.b64encode(data)
self.response.write('<html><body>Paste into command line:<br>')
self.response.write('<textArea rows="5" cols="80">')
self.response.write(cgi.escape(data64))
self.response.write('</textArea></body></html>')

def post(self):
self.response.write('<html><body>Paste the following Auth String into the prompt in the '
'command line of clevernote:<pre>')
self.response.write(cgi.escape(self.request.get('oauth_token')))
self.response.write('</pre></body></html>')

app = webapp2.WSGIApplication([
('/', MainHandler),
('/oauth', OAuthHandler)
], debug=True)

0 comments on commit 63fa4d3

Please sign in to comment.