3 Mar 2005 oubiwann   » (Journeyer)

Twisted and Advogato

programming :: python

Here are some quick notes on accessing Advogato from twisted's xmlrpc:
>>> from twisted.web import xmlrpc
>>> from twisted.trial.util import deferredResult
>>> user = 'oubiwann'
>>> pass = 'xxxxxx'
>>> x = xmlrpc.Proxy("http://www.advogato.org/XMLRPC")
>>> deferred = x.callRemote('diary.len', user)
>>> count = deferredResult(deferred)
>>> for i in range(0,count):
...   deferred = x.callRemote('diary.get', user, i)
...   html = deferredResult(deferred)
...   print html
And this will print out the contents of the diary entries.

To make a a new diary entry, just do this:
>>> deferred = x.callRemote('authenticate', user, pass)
>>> cookie = deferredResult(deferred)
>>> deferred = x.callRemote('diary.set', cookie, -1, 'This is a test entry via XML-RPC')
>>> status = deferredResult(deferred)

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!