diff --git a/README.md b/README.md index a6b47937..4c6583d1 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,37 @@ business_note_store = client.get_business_note_store() business_note_store.listNotebooks() ``` +### Using developer tokens ### +If you are building a script or application that will only access your own personal Evernote account, then you don't need to implement OAuth. + +``` +developer_token = "my developer token" + +# Set up the NoteStore client +client = EvernoteClient(token=developer_token) +note_store = client.get_note_store() + +# Make API calls +notebooks = note_store.listNotebooks() +for notebook in notebooks: + print "Notebook: ", notebook.name + +``` +If you use yinxiang +``` +developer_token = "my developer token" + +# Set up the NoteStore client +client = EvernoteClient(token=developer_token, yinxiang=True) +note_store = client.get_note_store() + +# Make API calls +notebooks = note_store.listNotebooks() +for notebook in notebooks: + print "Notebook: ", notebook.name + +``` + ### References ### - Evernote Developers: http://dev.evernote.com/ - API Document: http://dev.evernote.com/documentation/reference/ diff --git a/lib/evernote/api/client.py b/lib/evernote/api/client.py index 1772955f..abab71cb 100644 --- a/lib/evernote/api/client.py +++ b/lib/evernote/api/client.py @@ -20,10 +20,13 @@ def __init__(self, **options): self.consumer_key = options.get('consumer_key') self.consumer_secret = options.get('consumer_secret') self.sandbox = options.get('sandbox', True) + self.yinxiang = options.get('yinxiang', False) if self.sandbox: default_service_host = 'sandbox.evernote.com' else: default_service_host = 'www.evernote.com' + if yinxiang: + default_service_host = 'app.yinxiang.com' self.service_host = options.get('service_host', default_service_host) self.additional_headers = options.get('additional_headers', {}) self.token = options.get('token')