📜 ⬆️ ⬇️

Evernote API or What's Inside an Elephant?

In the comments to our previous blog posts on Habré, we mentioned that Evernote has its own API . Now I want to talk about it in more detail.


When we were just developing a synchronization protocol for Evernote, we wanted to achieve a cross-platform solution (the web part is written in Java, the client for Windows and Windows Mobile - in C ++, the clients for Mac and iPhone in Objective C). Something was needed that would allow to easily implement this protocol on different clients and allow the protocol to be extended as needed. In addition, we wanted to ensure the transfer of binary data on this protocol in order to reduce the amount of data transmitted. The choice fell on Thrift, the protocol used (and still used) on Facebook, and now becoming an open source project under the wing of Apache Incubator. Evernote developers even had a hand in developing the project, correcting errors and modifying Java, Objective-C, and Perl-implementation and Thrift.

What is Thrift?

Thrift is an RPC implementation that allows you to remotely call functions on a server. Thrift consists of three main things:
  1. binary protocol - a way of packing data structures;
  2. own declarative language for describing objects, their properties and methods;
  3. code generators for different languages ​​(Java, C, Ruby, Python, Perl, PHP, etc.), which, based on the described objects, generate native code that allows receiving objects from the server and calling their methods completely transparently.

So, the Evernote API is nothing more than the implementation of objects specific to us (User, Notepad, Note, etc.) and their properties described in the Thrift language. All existing Evernote clients themselves use this API, so there is no separation between “friend or foe”. All applications, both ours and third-party applications, are equal and use the same functions.
')
What is the Evernote API for?

There are two main ways to use the API:

1) Writing client applications for Evernote. In this case, the client application is authorized in the system under the name and password of a specific user and gets access to all objects. This method should be used by those services that involve working with only one specific user of Evernote.

2) Writing integration modules (plug-ins) for working with third-party services with the system itself. In this case, we use the OAuth protocol, which allows Evernote users to provide limited access to external applications to their account without having to disclose their password. This method should be used by those services that involve working with multiple Evernote users.

Ideas for using the Evernote API

1) A plugin for the popular blog engine (like WordPress) that automatically posts blog notes from a specific notepad to Evernote. What for? Imagine that you can prepare posts for a blog offline, on any Evernote client. In the same place where to collect information for your blog. This is the convenience of entering information provided by Evernote and the huge possibilities for customizing the appearance and commenting on the entries provided by the blog engines.

2) Specific clients and clippers. For example, an application that recognizes a barcode from the camera, which receives information from the barcode on the Internet and forms a note in Evernote. What for? You go around the store, photograph the price tags of goods (for example, books) on your phone, and at home in Evernote you already compare the products you like, get additional information on them, prices from online stores. This also includes capturing photos from webcams or integrating with scanners via TWAIN.

3) Communication with case planning systems. Imagine that from any Evernote client you enter notes like “tomorrow at eleven business meeting at the office”, and the reminder task gets into a service like Google Calendar, Remember The Milk, which subsequently notifies you of the planned case via SMS or email.

4) By analogy with the integration of Evernote and Twitter , you can come up with import services from ICQ, XMPP (Jabber), using SMS.

I think that you yourself will come up with other interesting ways to integrate with Evernote, which we do not even guess. There are already 900,000 Evernote users worldwide, and interacting with Evernote is a good chance to add value to your product. You can read about some of the examples of integration implemented in our English-language blog .

Where to begin?

Trying our API is very simple - download the required SDK on this page , which has usage examples and interface libraries, and send a request for an API key there, briefly writing about yourself (the name of the project, what the API is for and how it will be used). After receiving the key, you can safely experiment with our API on a special test server, the sandbox, without fear of doing something wrong. Please note that to work in the sandbox there you need to have a separate user account Evernote, because this server uses its own user database, which does not overlap with the main one.

Do not forget to visit our developer forum and ask any API questions there. Or ask here - we will try to help.

Separately, it is worth noting that the license for the Evernote API does not limit the developers in the way applications are distributed. It can be free and commercial development, open-source projects and projects with closed source. Here everything remains at your discretion.

Code example

Finally, I will give an example of Python code that authorizes a user by his username and password, reads the note body from STDIN and creates a note on the server:
  1. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  2. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  3. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  4. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  5. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  6. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  7. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  8. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  9. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  10. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  11. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  12. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  13. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  14. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  15. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  16. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  17. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  18. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  19. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  20. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  21. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  22. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  23. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  24. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  25. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  26. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  27. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  28. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  29. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  30. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  31. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  32. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  33. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  34. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  35. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  36. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  37. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  38. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  39. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  40. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  41. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  42. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  43. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  44. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  45. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  46. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  47. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  48. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  49. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  50. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  51. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  52. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  53. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  54. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  55. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  56. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  57. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  58. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  59. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  60. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  61. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  62. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  63. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  64. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  65. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  66. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  67. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  68. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  69. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  70. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  71. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  72. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)
  73. #!/usr/bin/python # coding=utf-8 # ( Evernote API) import time import thrift.transport.THttpClient as THttpClient import thrift.protocol.TBinaryProtocol as TBinaryProtocol import evernote.edam.userstore.UserStore as UserStore import evernote.edam.userstore.constants as UserStoreConstants import evernote.edam.notestore.NoteStore as NoteStore import evernote.edam.type.ttypes as Types # edamHost = "sandbox.evernote.com" # -"", edamPort = 443 # consumerKey = "your-api-key-here!" # , Evernote consumerSecret = "your-api-secret-here!" # , Evernote username = "your-username" # Evernote ( sandbox.evernote.com) password = "your-password" # Evernote # HTTP UserStore ( ) userStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, "/edam/user" ) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) userStore = UserStore.Client(userStoreProtocol) # , versionOK = userStore.checkVersion( "Python EDAMTest" , UserStoreConstants.EDAM_VERSION_MAJOR, UserStoreConstants.EDAM_VERSION_MINOR) print "Is my EDAM protocol version up to date? " , str(versionOK) if not versionOK: exit(1) # authResult = userStore.authenticate(username, password, consumerKey, consumerSecret) # User user = authResult.user # authToken = authResult.authenticationToken print "Authentication was successful for " , user.username print "Authentication token = " , authToken # HTTP NoteStore ( ) noteStoreUri = "/edam/note/" + user.shardId noteStoreHttpClient = THttpClient.THttpClient(edamHost, edamPort, noteStoreUri) noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient) noteStore = NoteStore.Client(noteStoreProtocol) # notebooks = noteStore.listNotebooks(authToken) # STDOUT , # print "Found " , len(notebooks), " notebooks:" for notebook in notebooks: print " * " , notebook.name if notebook.defaultNotebook: defaultNotebook = notebook # print print "Creating a new note in default notebook: " , defaultNotebook.name print # note = Types.Note() # note.notebookGuid = defaultNotebook.guid # note.title = raw_input( "Note title? " ).strip() # ENML ( XHTML ) note.content = '<?xml version="1.0" encoding="UTF-8"?>' note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">' note.content += '<en-note>' note.content += raw_input( "Well-formed XHTML note content? " ).strip() # XTML STDIN note.content += '</en-note>' # note.created = int (time.time() * 1000) # note.updated = note.created # , createdNote = noteStore.createNote(authToken, note) print "Created note: " , str(createdNote)

Source: https://habr.com/ru/post/57807/


All Articles