import markdown, string, xmlrpclib #http://www.freewisdom.org/projects/python-markdown/Installation xmlrpcurl = "http://www.example.com/blog/xmlrpc.php" username = "username" password = "password" textfile = open('30DaysBlogPost.txt','r') title = "" tags = [] while True: optionline = textfile.readline() if string.strip(optionline) == '%%%': break; if string.find(optionline, "Title:") == 0: title = string.strip(optionline[6:]) if string.find(optionline, "Tags:") == 0: tags = string.split(string.strip(optionline[5:]),",") newtaglist = [] for tag in tags: newtaglist.append(string.strip(tag)) tags = list(newtaglist) postbody = textfile.read() textfile.close() #print postbody body = markdown.markdown(postbody) # now we post to the blog server = xmlrpclib.Server(xmlrpcurl) postdict = {} postdict['title'] = title postdict['description'] = body postdict['mt_keywords'] = tags returnstring = server.metaWeblog.newPost(1,username, password,postdict,1) #change the last variable to 0 to save as a post draft instead of publishing. #returnstring = server.metaWeblog.getRecentPosts(1,username,password,3) #returnstring = server.wp.getUsersBlogs(username,password) print returnstring