X-Git-Url: https://projects.mako.cc/source/iron-blogger/blobdiff_plain/07f9582285ff3aa515b3e8ac10f27bd8c29378cf..1e83f5c2a466241b2c02b5a5d5c3d3936f5987ea:/weekly-update.py diff --git a/weekly-update.py b/weekly-update.py new file mode 100755 index 0000000..c513a14 --- /dev/null +++ b/weekly-update.py @@ -0,0 +1,30 @@ +#!/usr/bin/python +import render +import os +import sys +import xmlrpclib +import subprocess + +XMLRPC_ENDPOINT = 'http://iron-blogger.mit.edu/xmlrpc.php' +USER = 'nelhage' +BLOG_ID = 1 + +try: + subprocess.call(['stty', '-echo']) + passwd = raw_input("Password for %s: " % (USER,)) + print +finally: + subprocess.call(['stty', 'echo']) + +x = xmlrpclib.ServerProxy(XMLRPC_ENDPOINT) + +text = render.render_template('templates/week.tmpl', sys.argv[1]) + +lines = text.split("\n") +title = lines[0] +body = "\n".join(lines[1:]) + +page = dict(title = title, + description = body) + +x.metaWeblog.newPost(BLOG_ID, USER, passwd, page, True)