ConnectedText
September 08, 2010, 12:45:37 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: SMF - Just Installed!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Displaying Simplenote Notes in ConnectedText  (Read 205 times)
0 Members and 1 Guest are viewing this topic.
kuehnm
Beta testers
Master
****

Karma: +14/-0
Offline Offline

Posts: 229


View Profile
« on: March 07, 2010, 06:07:39 PM »

Those who follow my blog know that I have acquired an iTouch and that I use the popular Simplenote (http://simplenoteapp.com/) application for notes. It synchronizes with its own Website, which can be accessed in various ways. See http://takingnotenow.blogspot.com/2010/02/simplenote-and-chrome.html  and http://takingnotenow.blogspot.com/2010/02/simple-ahk-script-for-simplenote-and.html. I have now hacked a Python script that displays the notes in ConnectedText. Here it is:

Code:
<% Python
from urllib import urlopen        # standard Python library
from base64 import b64encode      # standard Python library
import simplejson                 # http://code.google.com/p/simplejson/

# Login credentials.
email = 'someone@somewhere.edu'
password = 'sekreet'

# Get my authorization token for later calls.
loginURL = 'https://simple-note.appspot.com/api/login'
creds = b64encode('email=%s&password=%s' % (email, password))
login = urlopen(loginURL, creds)
token = login.readline().rstrip()
login.close()

# Get the note index.
indexURL = 'https://simple-note.appspot.com/api/index?auth=%s&email=%s' % (token, email)
index = urlopen(indexURL)
noteList = simplejson.load(index)

baseURL = 'https://simple-note.appspot.com/api/note?key=%s&auth=%s&email=%s'
for i in noteList:
  noteURL = baseURL % (i['key'], token, email)
  title = urlopen(noteURL).readline().decode('utf-8').rstrip()[:40]
  text = urlopen(noteURL).readlines()
  if i['deleted'] == False:
     print "===" + title + "==="
     for line in text:
           print line
%>

It's based on this script: http://www.leancrew.com/all-this/2010/01/exploring-the-simplenote-api/. I am sure it can be improved upon, as I am not very familiar at all with Python.

But I thought that someone with an iTouch and ConnectedText might find it useful, as the RSS feed does not work with the Website.

I only need the Simplenotes notes to show up in ConnectedText (and not the other way around), as I am using Simplenote only for notes I take on the road, which I then put into ConnectedText for permanent storage.

Manfred

PS: Adding [1:] after for line in text ==> "for line in text[1:]:" will suppress the title in the body of the note (Simplenote simply uses the first line as title).
« Last Edit: March 08, 2010, 06:24:07 AM by kuehnm » Logged
Eduardo Mauro
Administrator
Wizard
*****

Karma: +10/-0
Online Online

Posts: 2139


View Profile
« Reply #1 on: March 08, 2010, 06:08:31 AM »

Can I add this post in Project Welcome?
Logged
kuehnm
Beta testers
Master
****

Karma: +14/-0
Offline Offline

Posts: 229


View Profile
« Reply #2 on: March 08, 2010, 06:17:04 AM »

Of course

Manfred
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!