From 934076a87ca7b613e917adb305fc0312f735273a Mon Sep 17 00:00:00 2001 From: Nelson Elhage Date: Wed, 30 Dec 2009 01:08:27 -0500 Subject: [PATCH] Script to update the participants page using the wordpress API. --- update-participants.py | 53 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 update-participants.py diff --git a/update-participants.py b/update-participants.py new file mode 100644 index 0000000..7f09576 --- /dev/null +++ b/update-participants.py @@ -0,0 +1,53 @@ +#!/usr/bin/python + +import render +import os +import sys +import xmlrpclib +import subprocess + +text = render.render_template('templates/users.tmpl') + +XMLRPC_ENDPOINT = 'http://iron-blogger.mit.edu/xmlrpc.php' +USER = 'nelhage' +BLOG_ID = 1 +PAGE_ID = 16 + +try: + subprocess.call(['stty', '-echo']) + passwd = raw_input("Password for %s: " % (USER,)) + print +finally: + subprocess.call(['stty', 'echo']) + +x = xmlrpclib.ServerProxy(XMLRPC_ENDPOINT) +page = x.wp.getPage(BLOG_ID, PAGE_ID, USER, passwd) + +page['description'] = text + +x.wp.editPage(BLOG_ID, PAGE_ID, USER, passwd, page, True) + +# Parameters +# int blog_id +# int page_id +# string username +# string password +# struct content +# string wp_slug +# string wp_password +# int wp_page_parent_id +# int wp_page_order +# int wp_author_id +# string title +# string description (content of post) +# string mt_excerpt +# string mt_text_more +# int mt_allow_comments (0 = closed, 1 = open) +# int mt_allow_pings (0 = closed, 1 = open) +# datetime dateCreated +# array custom_fields +# struct +# string id +# string key +# string value +# bool publish