Skip to content

Instantly share code, notes, and snippets.

@muzizongheng
Created July 18, 2013 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save muzizongheng/6027319 to your computer and use it in GitHub Desktop.
Save muzizongheng/6027319 to your computer and use it in GitHub Desktop.
use authoToken & noteStoreUrl to init evernote's noteStore
#init evernote client
def initEvernote(self):
# Real applications authenticate with Evernote using OAuth, but for the
# purpose of exploring the API, you can get a developer token that allows
# you to access your own Evernote account. To get a developer token, visit
# https://sandbox.evernote.com/api/DeveloperToken.action
if self.authToken == "":
self.authToken = input("Please input your dev token: ")
if self.authToken == "":
print("Please fill in your developer token")
print("To get a developer token, visit https://sandbox.evernote.com/api/DeveloperToken.action")
exit(1)
# Initial development is performed on our sandbox server. To use the production
# service, change "sandbox.evernote.com" to "www.evernote.com" and replace your
# developer token above with a token from
# https://www.evernote.com/api/DeveloperToken.action
# evernoteHost = "sandbox.evernote.com"
# userStoreUri = "https://" + evernoteHost + "/edam/user"
# userStoreHttpClient = THttpClient.THttpClient(userStoreUri)
# userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient)
# userStore = UserStore.Client(userStoreProtocol)
# Get the URL used to interact with the contents of the user's account
# When your application authenticates using OAuth, the NoteStore URL will
# be returned along with the auth token in the final OAuth request.
# In that case, you don't need to make this call.
if self.noteStoreUrl == "":
self.noteStoreUrl = input("Please input your noteStoreUrl")#userStore.getNoteStoreUrl(authToken)
print(self.noteStoreUrl)
noteStoreHttpClient = THttpClient.THttpClient(self.noteStoreUrl)
noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient)
noteStore = NoteStore.Client(noteStoreProtocol)
return noteStore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment