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

add use dev token for yinxiang #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
3 changes: 3 additions & 0 deletions lib/evernote/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down