#!/usr/bin/env python """ quickblog - simple python script to post to a blog that supports the blogger xmlrpc api sample config (~/.quickblog/config) [default] blog_url = http://example.com/xmlrpc.php username = someone password = something blogid = 1 """ import sys, tempfile, os, ConfigParser # python 2.1 std lib import xmlrpclib # python 2.2 std lib or at http://effbot.org/downloads/xmlrpclib-1.0.1.zip APP_KEY = '0' APP_PATH = os.path.expanduser('~/.quickblog') CONFIG_PATH = APP_PATH + '/config' def quickblog(): # make our app directory try: os.makedirs(APP_PATH) except OSError: pass # read the config file config = ConfigParser.ConfigParser() config.read(CONFIG_PATH) check_config(config) filename = os.path.join(APP_PATH, tempfile.gettempprefix()) # start editor os.system("%s %s" % (os.environ['EDITOR'], filename)) answer = raw_input('Post? (y/N):').lower() if answer != 'y': sys.exit() # mark up ff = open(filename, 'r') title = ff.readline().strip() blog_entry = ff.read().strip() ff.close() blog_entry = "