Skip to content

Instantly share code, notes, and snippets.

View brettkelly's full-sized avatar

Brett Kelly brettkelly

View GitHub Profile
# I'm a python file
dev_token = "put your dev token here"
client = EvernoteClient(token=dev_token)
userStore = client.get_user_store()
user = userStore.getUser()
print user.username
noteStore = client.get_note_store()
notebook = Types.Notebook()
notebook.name = "My Notebook"
notebook = noteStore.createNotebook(notebook)
print notebook.guid
noteStore = client.get_note_store()
note = Types.Note()
note.title = "I'm a test note!"
note.content = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">'
note.content += '<en-note>Hello, world!</en-note>'
note = noteStore.createNote(note)
noteStore = client.get_note_store()
notebooks = noteStore.listNotebooks()
for n in notebooks:
print n.name
client = EvernoteClient(token=auth_token)
userStore = client.get_user_store()
user = userStore.getUser()
@brettkelly
brettkelly / oauth_example.py
Created February 26, 2013 18:55
Authenticate with the Evernote Cloud API using OAuth and Python
# Python OAuth example
import evernote.edam.userstore.constants as UserStoreConstants
import evernote.edam.type.ttypes as Types
from evernote.api.client import EvernoteClient
##
# Helper function to turn query string parameters into a
# Python dictionary
##
@brettkelly
brettkelly / gist:5033632
Created February 25, 2013 21:46
Git instructions for adding Python SDK as a submodule
git submodule add git://github.com/evernote/evernote-sdk-python/ evernote
git submodule init
git submodule update
@brettkelly
brettkelly / example.py
Created February 25, 2013 19:56
getNote example
filter = NoteStore.NoteFilter()
filter.ascending = False
spec = NoteStore.NotesMetadataResultSpec()
spec.includeTitle = True
ourNoteList = noteStore.findNotesMetadata(authToken, filter, 0, 100, spec)
wholeNotes = []
for note in ourNoteList.notes:
@brettkelly
brettkelly / example.py
Created February 25, 2013 19:33
findNotesMetadata results
filter = NoteStore.NoteFilter()
filter.ascending = False
spec = NoteStore.NotesMetadataResultSpec()
spec.includeTitle = True
ourNoteList = noteStore.findNotesMetadata(authToken, filter, 0, 100, spec)
for note in ourNoteList.notes:
print "%s :: %s" % (note.guid, note.title)