Hello, this is IT Dr. HO. Today, we are going to learn how to automatically post a WordPress post with Python.
 



Ready - Python, PyCharm

1. Enter the following command in the terminal and install it

pip install python-wordpress-xmlrpc


2. And put the code below

//Below is the python code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from wordpress_xmlrpc import Client

from wordpress_xmlrpc import WordPressPost

from wordpress_xmlrpc.methods import posts



client= Client("http://adress/xmlrpc.php","ID","PW")

postx =WordPressPost()

postx.title ='wordpress  word'

post.slug ='coffee'

postx.content ='hi myname is name'

postx.terms_names ={

' ',

' '

}



postx.post_status= 'publish'

client.call(posts.NewPost(postx))