programming :: python
Here are some quick notes on accessing Advogato from twisted's xmlrpc:
To make a a new diary entry, just do this:
>>> 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)
