You Either Surf or You Fight: Integrating Library Services With Google Wave<br />Sean Hannan<br />Sheridan Libraries<br />...
Google Wave<br />http://wave.google.com<br />Collaborative platform<br />
Why Library Services there?<br />You can’t always force users to come to you<br />Go where they are<br />
Wave Apps<br />Two types <br />Gadgets<br />Like existing iGoogle gadgets<br />Robots<br />Real-time interaction<br />Let’...
Already on Wave?<br />Invite uncle-milty@appspot.com to a conversation<br />
Creating a Wave Robot<br />Libraries for Java and Python<br />Deployment using Google AppEngine<br />
App Engine<br />http://appengine.google.com<br />Google’s cloud-computing platform<br />Free for up to 1.3 million request...
Set up the Application<br />Create an application at appengine.google.com<br />Set up an application identifier <app>.apps...
App Engine SDK<br />Download the App Engine SDK from http://code.google.com/appengine/downloads.html<br />Start the App En...
Set up the app.yaml<br />application: uncle-milty<br />version: 2<br />runtime: python<br />api_version: 1<br />handlers:<...
Wave Robot API<br />Download the files from svn:<br />svn checkout http://wave-robot-python-client.googlecode.com/svn/trun...
Wave Concepts<br />Wavelet<br />The conversation taking place within Google Wave<br />Blip<br />Every message as part of t...
Project Overview<br />A simple chat bot<br />Searches the library catalog for results<br />
Code it up!<br />Available on github: http://github.com/MrDys/uncle-milty<br />
External Libraries<br />External libraries are a-okay<br />Just drop it in the project directory<br />Going to use Beautif...
Imports<br />from waveapi import events<br />from waveapi import model<br />from waveapi import robot<br />from waveapi im...
OnRobotAdded Function<br />def OnRobotAdded(properties, context):<br />  """Invoked when the robot has been added."""<br /...
OnBlip Submitted Function<br />def OnBlipSubmitted(properties, context):<br />  blip = context.GetBlipById(properties['bli...
OnBlipSubmitted Function con’t<br /> soup = BeautifulSoup(page)<br />  results = soup.findAll(title="View more information...
OnBlipSumitted Function con’t<br />outputstr = ""<br />  count = 0<br />  for i  in results:<br />    if count >= 5:<br />...
OnBlipSubmitted Function con’t<br />logging.debug(outputstr)<br />sub_blipdoc.SetText(" ")<br />  builder = OpBuilder(cont...
Register Event Handlers<br />if __name__ == '__main__':<br />myRobot = robot.Robot('Milton S. Eisenhower', <br />image_url...
Gotchas<br />CSS<br />Doesn’t really like it, so keep it simple<br />HTML Links<br />Won’t let you do it directly, must us...
Deployment<br />Just hit ‘Deploy’ in the App Engine Launcher<br />
Debugging<br />Use the logging library<br />View the log results in realtime on http://appengine.google.com<br />
What next?<br />Could be improved in a lot of ways<br />More services integrated<br />Create a menu-like system to select ...
Q&A<br />Questions?<br />
Upcoming SlideShare
Loading in...5
×

You Either Surf Or You Fight

3,515

Published on

Integrating Library Services with Google Wave

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,515
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
11
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

You Either Surf Or You Fight

  1. 1. You Either Surf or You Fight: Integrating Library Services With Google Wave<br />Sean Hannan<br />Sheridan Libraries<br />Johns Hopkins University<br />
  2. 2. Google Wave<br />http://wave.google.com<br />Collaborative platform<br />
  3. 3. Why Library Services there?<br />You can’t always force users to come to you<br />Go where they are<br />
  4. 4. Wave Apps<br />Two types <br />Gadgets<br />Like existing iGoogle gadgets<br />Robots<br />Real-time interaction<br />Let’s go for the real-time interaction<br />
  5. 5. Already on Wave?<br />Invite uncle-milty@appspot.com to a conversation<br />
  6. 6. Creating a Wave Robot<br />Libraries for Java and Python<br />Deployment using Google AppEngine<br />
  7. 7. App Engine<br />http://appengine.google.com<br />Google’s cloud-computing platform<br />Free for up to 1.3 million requests per day<br />
  8. 8. Set up the Application<br />Create an application at appengine.google.com<br />Set up an application identifier <app>.appspot.com<br />
  9. 9. App Engine SDK<br />Download the App Engine SDK from http://code.google.com/appengine/downloads.html<br />Start the App Engine Launcher and create a new application<br />
  10. 10. Set up the app.yaml<br />application: uncle-milty<br />version: 2<br />runtime: python<br />api_version: 1<br />handlers:<br />- url: /_wave/.*<br /> script: uncle-milty.py<br />- url: /assets<br />static_dir: assets<br />
  11. 11. Wave Robot API<br />Download the files from svn:<br />svn checkout http://wave-robot-python-client.googlecode.com/svn/trunk/src/waveapi waveapi<br />Drop it in the application directory<br />
  12. 12. Wave Concepts<br />Wavelet<br />The conversation taking place within Google Wave<br />Blip<br />Every message as part of the wavelet<br />Hierarchical <br />Each of these have unique identifiers that can be used to programmatically address them<br />
  13. 13. Project Overview<br />A simple chat bot<br />Searches the library catalog for results<br />
  14. 14. Code it up!<br />Available on github: http://github.com/MrDys/uncle-milty<br />
  15. 15. External Libraries<br />External libraries are a-okay<br />Just drop it in the project directory<br />Going to use BeautifulSoup to scrape the OPAC<br />
  16. 16. Imports<br />from waveapi import events<br />from waveapi import model<br />from waveapi import robot<br />from waveapi import document<br />from waveapi.ops import OpBuilder<br />import logging<br />import urllib2<br />from BeautifulSoup import BeautifulSoup<br />
  17. 17. OnRobotAdded Function<br />def OnRobotAdded(properties, context):<br /> """Invoked when the robot has been added."""<br />logging.debug("created")<br />root_wavelet = context.GetRootWavelet()<br />root_wavelet.CreateBlip().GetDocument().SetText("Hi, I'm Milton S. Eisenhower and I'd be happy to help you with your research. I will search the JHU catalog for anything that you say to me and I'll let you know if I find anything.")<br />
  18. 18. OnBlip Submitted Function<br />def OnBlipSubmitted(properties, context):<br /> blip = context.GetBlipById(properties['blipId'])<br /> page = urllib2.urlopen("https://catalog.library.jhu.edu/ipac20/ipac.jsp?menu=search&aspect=subtab22&npp=5&ipp=20&spp=20&profile=general&ri=&index=ALTITLE&term=" + blip.GetDocument().GetText() + "&x=0&y=0&aspect=subtab22")<br />
  19. 19. OnBlipSubmitted Function con’t<br /> soup = BeautifulSoup(page)<br /> results = soup.findAll(title="View more information")<br />sub_blip = context.GetRootWavelet().CreateBlip()<br />sub_blipdoc = sub_blip.GetDocument()<br />
  20. 20. OnBlipSumitted Function con’t<br />outputstr = ""<br /> count = 0<br /> for i in results:<br /> if count >= 5:<br /> break<br /> else:<br />itemstr = str(i)<br />itemstr = itemstr.replace('class="smallBoldAnchor"', '')<br />outputstr = outputstr + itemstr + "<br/>"<br /> count = count + 1<br />
  21. 21. OnBlipSubmitted Function con’t<br />logging.debug(outputstr)<br />sub_blipdoc.SetText(" ")<br /> builder = OpBuilder(context)<br />builder.DocumentAppendMarkup(sub_blip.waveId, sub_blip.waveletId, sub_blip.blipId, outputstr)<br />logging.debug(sub_blip.waveId + " " + sub_blip.waveletId + " " + sub_blip.blipId)<br />
  22. 22. Register Event Handlers<br />if __name__ == '__main__':<br />myRobot = robot.Robot('Milton S. Eisenhower', <br />image_url='http://uncle-milty.appspot.com/assets/milty.png',<br /> version='2',<br />profile_url='http://uncle-milty.appspot.com/')<br />myRobot.RegisterHandler(events.BLIP_SUBMITTED, OnBlipSubmitted)<br />myRobot.RegisterHandler(events.WAVELET_SELF_ADDED, OnRobotAdded)<br />myRobot.Run()<br />
  23. 23. Gotchas<br />CSS<br />Doesn’t really like it, so keep it simple<br />HTML Links<br />Won’t let you do it directly, must use OpBuilder<br />
  24. 24. Deployment<br />Just hit ‘Deploy’ in the App Engine Launcher<br />
  25. 25. Debugging<br />Use the logging library<br />View the log results in realtime on http://appengine.google.com<br />
  26. 26. What next?<br />Could be improved in a lot of ways<br />More services integrated<br />Create a menu-like system to select options<br />
  27. 27. Q&A<br />Questions?<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×