1. vrde
  2. python-wave-surfer

Wiki

Clone wiki

python-wave-surfer / Home

Intro

Here is my simple implementation for a google wave API — deeply inspired by hiroshi's work and from a folengo's idea.

The API module, wavesurfer.py, implements only the login and two functions to retrieve your waves. The API module uses the Python Standard Library so just import it (on GNU/Linux, mac os, win and… Symbian maybe?) and play :)

(original post in my blog)

Docs

import wavesurfer and create a new instance of Waves, the __init__ takes two params: the username and the password.

Properties

Use the property all to get a list with all the waves, the property unread for the new or updated waves.

Methods

Use the method sync to update all and unread.

Example

>>> from wavesurfer import Waves
>>> waves = Waves('foo@gmail.com', 'password')
>>> waves.all
[{'url': u'googlewave.com!w+xxxxxxxxx', 'total': 36, 'unread': 0, 'title': u'ciao pythonisti!'},
 {'url': u'googlewave.com!w+xxxxxxxxx', 'total': 15, 'unread': 0, 'title': u'come funzia sta roba?'},
 {'url': u'googlewave.com!w+xxxxxxxxx', 'total': 43, 'unread': 0, 'title': u'OT'},
 {'url': u'googlewave.com!w+xxxxxxxxx', 'total': 5,  'unread': 0, 'title': u'\u544a\u8a34\u6211!!!'}, ... ]
>>> waves.sync()
>>> # ...later...
>>> waves.all
[{'url': u'googlewave.com!w+xxxxxxxxx', 'total': 38, 'unread': 2, 'title': u'ciao pythonisti!'},
 {'url': u'googlewave.com!w+xxxxxxxxx', 'total': 16, 'unread': 1, 'title': u'come funzia sta roba?'},
 {'url': u'googlewave.com!w+xxxxxxxxx', 'total': 43, 'unread': 0, 'title': u'OT'},
 {'url': u'googlewave.com!w+xxxxxxxxx', 'total': 5,  'unread': 0, 'title': u'\u544a\u8a34\u6211!!!'}, ... ]
>>> waves.unread
[{'url': u'googlewave.com!w+xxxxxxxxx', 'total': 38, 'unread': 2, 'title': u'ciao pythonisti!'},
 {'url': u'googlewave.com!w+xxxxxxxxx', 'total': 17, 'unread': 1, 'title': u'come funzia sta roba?'}]

License

GPL3

Updated