$ vi blog_post.py
# Import needed libraries:
import xmlrpclib;
from pprint import pprint;
# Define the blog publishing function
def blogPost( server, username, password, categories, tags, title, content ):
  
    datastruct = {'description':content, 'title':title, 'categories':categories, 'mt_keywords':tags}
    returncode = server.metaWeblog.newPost('1',username,password,datastruct,1)
    print returncode

servname = xmlrpclib.Server("http://howto.homelinux.com/wordpress/xmlrpc.php")

# Initialize the settings
d_username = 'blog_id'
d_password = 'blog_passwd'
pprint(servname.system.listMethods())

n_categories = ['Home Linux']
n_title = 'python post test';
n_content = 'posting using python script.';
n_tags = ['test'];
 
blogPost(servname, d_username, d_password, n_categories, n_tags, n_title, n_content)

$ python blog_post.py

'OldStory > Home Linux' 카테고리의 다른 글

Open Clip Art Library  (0) 2009.06.17
python post test  (0) 2009.06.04
Post using python script  (0) 2009.06.04
XML-RPC servers for Python  (0) 2009.06.04
[Ubuntu] SCIM 한글 입력 설정  (0) 2009.05.28
Wandering In The Sky  (0) 2009.05.15
by Alnilam 2009. 6. 4. 18:52
| 1 2 3 4 |