#!/usr/bin/python2.2 import time import sys import urllib2 import libxml2 from PyMT import * MTurl = 'http://marcolson.net/cgi-bin/mt-xmlrpc.cgi' MTuser = 'molson' MTpass = '**********' MTblogid = 1 MTcategory = [ 22 ] date = time.strftime("%Y-%m-%d", time.localtime()) date2 = time.strftime("%d %b %Y", time.localtime()) # Set up authentication info. authinfo = urllib2.HTTPBasicAuthHandler() authinfo.add_password('del.icio.us API', 'http://del.icio.us', 'molson', '*********') opener = urllib2.build_opener(authinfo) urllib2.install_opener(opener) xml = libxml2.parseDoc(urllib2.urlopen('http://del.icio.us/api/posts/get?dt=%s' % date).read()) posts = xml.xpathEval("/posts/post") if posts: title = "" blogpost = "" title = "Links for %s [del.icio.us]" % date2 blogpost += "\n" mt = PyMT(MTurl, MTuser, MTpass) content = {'title': title, 'description': blogpost, 'categories': MTcategory, 'mt_allow_comments': 0, 'mt_allow_pings': 0, 'mt_convert_breaks': 1 } new = mt.newPost(MTblogid, content, 1)