import xmlrpclib
def getfile(filename):
filehandle = open(filename, “r”)
filecontents = filehandle.read()
#textview.delete(“1.0″, “end”)
#textview.insert(“end”, filecontents)
filehandle.close()
return filecontents
def openfile():
import tkFileDialog
filename = tkFileDialog.askopenfilename()
return filename
user = ‘user’
passwd = ‘passwd’
server = xmlrpclib.ServerProxy(‘http://rhdblog.wordpress.com/xmlrpc.php’)
blog_id = 0
#title = ‘Test Posting From Python LAgi’
title=raw_input(‘Judul Posting’)
#content = ‘test content, from python…tessssssss lagiii’
#content=raw_input(‘Isi Posting’)
fl=raw_input(‘Nama File’)
content=getfile(fl)+’Posted from My Mobile O2+Python‘
result = server.metaWeblog.getCategories(blog_id, user, passwd)
cat=raw_input(“PIlih ID Category= “)
blog_content = { ‘title’ : title, ‘description’ : content }
categories = [{'categoryId' : cat, 'isPrimary' : 1}]
#cat_id=raw_input(‘Category ID= ‘)
post_id = int(server.metaWeblog.newPost(blog_id, user, passwd, blog_content,1))
server.mt.setPostCategories(post_id, user, passwd, categories) # not work
server.mt.publishPost(post_id, user, passwd)
Posted from My Mobile O2+Python
Tidak ada komentar:
Posting Komentar
Berkomentarlah jika ada pertanyaan seputar artikel ini dengan santun bahasa Indonesia yang baik.