# Test access to Wordpress # # Comment: Quite a usefull API to attach external scripts!!! # import sys from wordpress_xmlrpc import Client from wordpress_xmlrpc import WordPressPost, WordPressComment from wordpress_xmlrpc.methods.posts import GetPost from config import * # Access WP post # How to detector if it is available??? # Use Wordpress account - not the mysql credentials # Todo: use scopus later !!! wp = Client(wp_api_url, wp_user, wp_password) wpid = 1149 if len(sys.argv) > 1: wpid = int(sys.argv[1]) # Read post try: post = wp.call(GetPost(wpid)) print ("Post %d: %s" %(wpid,post.title)) except: print ("Post %d seems to be not available" % wpid)