Kode Python CE sederhana untuk posting wordpress via Windows

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

Comments

Popular posts from this blog

KARYA NYATA INOVASI PEMBELAJARAN PEMBUATAN DESAIN GRAFIS PERIKLANAN MENGGUNAKAN TEKNIK POP ART

Verifikasi Adsense Lewat Triod

20 Top Website Tempat Upload File SWF dan Flash