My Experiences with Databases & More

Oracle-MySQL-SQL SERVER-Python-Azure-AWS-Oracle Cloud-GCP etc

  • Enter your email address to follow this blog and receive notifications of new posts by email.

  • Total Views

    • 558,488 hits
  • $riram $anka


    The experiences, Test cases, views, and opinions etc expressed in this website are my own and does not reflect the views or opinions of my employer. This site is independent of and does not represent Oracle Corporation in any way. Oracle does not officially sponsor, approve, or endorse this site or its content.Product and company names mentioned in this website may be the trademarks of their respective owners.

Sample Script to Publish a blog Post #Python

Posted by Sriram Sanka on March 29, 2023


Sample Script to Publish a blog Post Using Python

This post is Auto published using Python script attached below. #Python

import json
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods.posts import NewPost
import getpass
password = getpass.getpass(prompt='Password: ', stream=None)  //Blog Login Password 
def auto_blog_post(blog_content,blog_excerpt,blog_status):
    id = 'sriramoracle'   //User Name
    url = 'https://sriramoracle.wordpress.com/xmlrpc.php'
    wp = Client(url, id, password)
    post = WordPressPost()
    post.post_status = blog_status
    post.title = blog_excerpt
    post.content = blog_content
    post.excerpt = blog_excerpt
    post.terms_names = {
        "post_tag": ['Python'],
        "category": ['Python']
    }
    wp.call(NewPost(post))
auto_blog_post('Sample Script to Publish a blog Post Using Python ','Sample Script to Publish a blog Post ' ,'publish')  //publish will publish the Post, Draft is the default mode. 

Sorry, the comment form is closed at this time.

 
%d bloggers like this: