1
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
2
# See LICENSE for details.
8
advogato.py <name> <diary entry file>
11
from twisted.web.xmlrpc import Proxy
12
from twisted.internet import reactor
13
from getpass import getpass
18
def __init__(self, name, password):
20
self.password = password
21
self.proxy = Proxy('http://advogato.org/XMLRPC')
23
def __call__(self, filename):
24
self.data = open(filename).read()
25
d = self.proxy.callRemote('authenticate', self.name, self.password)
26
d.addCallbacks(self.login, self.noLogin)
28
def noLogin(self, reason):
29
print "could not login"
32
def login(self, cookie):
33
d = self.proxy.callRemote('diary.set', cookie, -1, self.data)
34
d.addCallbacks(self.setDiary, self.errorSetDiary)
36
def setDiary(self, response):
39
def errorSetDiary(self, error):
40
print "could not set diary", error
43
diary = AddDiary(sys.argv[1], getpass())