So I started to code my first Python lines, learned bout JSON, took a close look at the entity broker of Sakai, wandered through Google's App Engine and did some serious reading on the GW API's.
The fact that GW doesn't have a SDK (yet) with which you can develop on your own computer. Every time I had new or adjusted code I had to upload it to App Engine.
This is what I did. I have written a robot of approx 80 lines of (Python) code which runs on App Engine. First it authenticates, second it retrieves site information and third it adds a poll to a Sakai site.
Code authentication:
"""define login url for Sakai"""
host = "http://qa1-nl.sakaiproject.org"
loginurl = "/portal/xlogin"
url = host+loginurl
form_data = urllib.urlencode({'eid':'','pw':' '})
f = opener.open(url, form_data)
data = f.read()
f.close()
This is just Python code and it authenticates me on a Sakai server which runs 2.5.3. btw.
Now I wanted to retrieve site information out of Sakai. RESTful & JSON are my big friends here.
"""Get sit info"""
jsonsiteurl="/direct/site.json"
url = host + jsonsiteurl
f = opener.open(url)
data = f.read()
f.close()
result = simplejson.loads(data)
mylist = result.get('site_collection')
for outerlist in mylist:
for innerlist in outerlist:
blip.GetDocument().AppendText(simplejson.dumps(outerlist.get(innerlist)))
It uses the url "
Now that we have retrieve some data I wanted to post some data from GW into Sakai. I added a new Poll to my site.
pollurl = "/direct/poll/new"
url = host + pollurl
form_data = urllib.urlencode({
"text": "What do you think of Google Wave?",
"owner": "fbc345bd-8ef0-4060-90fd-4fb2fa028961",
"siteId": "5ab7c822-ccd6-4568-ab8b-deeb3b63630c",
"pollText": "What do you think of Google Wave?"})
f = opener.open(url,form_data)
f.close()
I use JSON again by posting to '
What I wanted to check with this robot is how difficult it would be to post and get data between Google Wave and Sakai. It is pretty easy with the use of JSON messages. I don't have to know anything how Sakai handles its stuff internally. All I have to do is to call the url which handles the stuff for me.
So I have my first robot which I called 'Saky' (seems to be the naming convention of GW robots) for the moment and I can upload it to my app-engine.
So what's next? From now on I want to focus on Sakai K2. I think Sling is a wonderful technological solution and it makes me wonder how we could integrate this new kernel with Google Wave. To be continued....
I want to thank Alan Berg for helping me with some Python stuff. I want thank Chuck Severance for writing a book about the App Engine. It really helps! And I want to thank Aaron Zeckoski for thinking along why my handling of JSON messages got messed up which turned out to be a local problem on my Mac.
