Hi, I am trying to create a blog app built on evernote that basically allows you to view any public notebook in a more 'bloggy' form.
Assume I have the username of a Evernote user with 0 or more public notebooks. For example, my username is occulens. Given this username, is it possible to get a list of my public notebooks without authenticating? (assume we have username, consumerKey and consumerSecret, but nothing else)
What might this code look like? (python or psuedocode is preferred)
Get list of public notebooks given a username
Started by occulens, Nov 26 2011 02:07 PM
python api userstore notestore auth authentication public shared notebook
1 reply to this topic
#1
Posted 26 November 2011 - 02:07 PM
#2
Posted 26 November 2011 - 11:30 PM
OK, I got it figured out. Here's what I learned:
Not quite. You can't get a list of someone's public notebooks based on their username. This may be a choice that evernote made -- to protect people's privacy. So, you will also need the name of the public notebook. From there you can read all the notebook data.
And here's the python code:
Given this username, is it possible to get a list of my public notebooks without authenticating? (assume we have username, consumerKey and consumerSecret, but nothing else)
Not quite. You can't get a list of someone's public notebooks based on their username. This may be a choice that evernote made -- to protect people's privacy. So, you will also need the name of the public notebook. From there you can read all the notebook data.
And here's the python code:
#This code was adapted from the API sample file EDAMTest.py
#You'll need a public notebook somwhere in the sandbox. You'll also need to set the notebook_name to the name of your public notebook.
import sys
import hashlib
import binascii
import time
import thrift.protocol.TBinaryProtocol as TBinaryProtocol
import thrift.transport.THttpClient as THttpClient
import evernote.edam.userstore.UserStore as UserStore
import evernote.edam.userstore.constants as UserStoreConstants
import evernote.edam.notestore.NoteStore as NoteStore
import evernote.edam.notestore.ttypes as NoteStoreTypes
import evernote.edam.type.ttypes as Types
import evernote.edam.error.ttypes as Errors
# NOTE: You must change the consumer key and consumer secret to the
# key and secret that you received from Evernote
#
consumerKey = "YOUR KEY HERE"
consumerSecret = "YOUR SECRET HERE"
evernoteHost = "sandbox.evernote.com"
userStoreUri = "https://" + evernoteHost + "/edam/user"
noteStoreUriBase = "https://" + evernoteHost + "/edam/note/"
userStoreHttpClient = THttpClient.THttpClient(userStoreUri)
userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient)
userStore = UserStore.Client(userStoreProtocol)
versionOK = userStore.checkVersion("Python EDAMTest",
UserStoreConstants.EDAM_VERSION_MAJOR,
UserStoreConstants.EDAM_VERSION_MINOR)
#check EDAM protocol version
print "Is my EDAM protocol version up to date? ", str(versionOK)
print ""
if not versionOK:
print "No. Exiting."
exit(1)
#get basic user info
user = userStore.getPublicUserInfo('occulens')
noteStoreUri = noteStoreUriBase + user.shardId
noteStoreHttpClient = THttpClient.THttpClient(noteStoreUri)
noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient)
noteStore = NoteStore.Client(noteStoreProtocol)
notebook_name = 'blog'
try:
notebook = noteStore.getPublicNotebook(user.userId, notebook_name)
except Errors.EDAMNotFoundException:
print "we couldn't find the public notebook " + notebook_name
exit(1)
note_filter = NoteStoreTypes.NoteFilter(notebookGuid=notebook.guid)
notelist = noteStore.findNotes('', note_filter, 0, 10)
for note in notelist.notes:
print 'guid: ' + str(note.guid) + ' title: ' + note.title
print 'done!'
Also tagged with one or more of these keywords: python, api, userstore, notestore, auth, authentication, public, shared, notebook
Learn & Share →
Evernote for Developers →
Delayed or no responce from Sandbox notestoreStarted by Luke Middlewick, 17 May 2013 |
|
|
||
Learn & Share →
Evernote for Developers →
How do webhooks work with Evernote Business?Started by realistdreamer, 13 May 2013 |
|
|
||
Mac
Evernote Products →
Evernote →
Help! I moved all notes into 1 notebookStarted by Douglas Bray, 13 May 2013 |
|
|
||
Learn & Share →
Evernote for Developers →
updating note in shared notebookStarted by Christopher Metts, 08 May 2013 |
|
|
||
Learn & Share →
Evernote for Developers →
findNotes error in PythonStarted by Christopher Metts, 07 May 2013 |
|
|
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users












