The goal of simplenote-index is to give me those keys so I can hard-wire them into my syncing scripts. These are character strings that uniquely identify each note and are essential for scripts that read and write notes. The important thing for the work I intend to do later are the keys. Like Simplenote itself, the script treats the first line of each note as its title (the script prints only the first 40 characters of the title so the formatting doesn’t get screwed up). Key: agtzaW1wbGUtbm90ZXIMCxIETm90ZRiTii8M Key: agtzaW1wbGUtbm90ZXIMCxIETm90ZRiH5BsM Key: agtzaW1wbGUtbm90ZXIMCxIETm90ZRiG5BsM Key: agtzaW1wbGUtbm90ZXIMCxIETm90ZRjT3h4M Key: agtzaW1wbGUtbm90ZXIMCxIETm90ZRik5h4M Key: agtzaW1wbGUtbm90ZXIMCxIETm90ZRi35h4M Key: agtzaW1wbGUtbm90ZXIMCxIETm90ZRjC3h4M Key: agtzaW1wbGUtbm90ZXIMCxIETm90ZRij5h4M Key: agtzaW1wbGUtbm90ZXIMCxIETm90ZRiF5BsM Here’s the sort of output to expect: Title: Hardware store It logs in, gets an authorization token, then collects the information on each of your notes on the server. I think the comments explain it pretty well there’s not much to it. 1: #!/usr/bin/pythonģ: from urllib import urlopen # standard Python libraryĤ: from base64 import b64encode # standard Python libraryġ1: # Get my authorization token for later calls.ġ3: creds = b64encode('email=%s&password=%s' % (email, password))Ģ3: # Print the first line of each note along with its key.Ģ6: noteURL = baseURL % (i, token, email)Ģ7: title = urlopen(noteURL).readline().decode('utf-8').rstrip()ģ2: ''' % (title, i, i, i) I’m looking for something a little more fine-grained than that-a way of syncing individual notes to individual files that can be anywhere on my computer.Īs a first step, I wrote the following script, simplenote-index, which gathers and prints out information for all the notes on the Simplenote server. One, Fletcher Penney’s SimplenoteSync, is more general, but works by syncing all the notes to a set of files in a single directory on your local computer. Most of them, unfortunately, are tied to special note-taking apps that I don’t want install. There are, as you may know, already several ways to sync your Simplenotes. I haven’t done any syncing yet, but I have written a utility script that will get me started. I’ve been meaning to work with the Simplenote API ever since it was announced, thinking it would be a good way to keep my plain-text todo lists 1 synced between my computers and my iPhone. Next post Previous post Exploring the Simplenote API
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |