pyblogger example code


#!/usr/bin/python
#import sys
# you may need to call
#sys.path.append
# to get the directories with your installation of
# xmlrpclib and pyblogger in place
import blogger
# ok, so I’m not exactly treating it like a “constant”,
# but it is easier this way
blogger.constants.xmlrpcServer = “http://wouldntyouliketoknow”
# omit the previous line if using blogger.com to post
username = “andrew”
password = “******”
# likewise, change the above two to match yours appropriately
blogs = blogger.listBlogs(username, password)
myFirstBlog = blogs[0]
url = myFirstBlog[”url”]
blogID = myFirstBlog[”blogid”]
postID = blogger.newPost(blogID, username, password, “”"This is a test to see if the installation of pyblogger is working.”"”,1)
print “New post is available at %s#%s” % (url, postID)