[英]Create a new wordpress post using Python (xmlrpc or wordpress_xmlrpc)
我正在嘗試自動發布一些博客文章,以便我可以自動將文本文件的內容發布到我用於學校的wordpress網站上。 該網站是wordpress版本4.1.1
到目前為止,我已經嘗試使用wordpress_xmlrpc方法並且遇到了一些困難。
這是我一直嘗試使用的代碼示例:
from wordpress_xmlrpc import Client
from wordpress_xmlrpc.methods import posts
client = Client(...)
posts = client.call(posts.GetPosts())
page = WordPressPage()
page.title = 'About Me'
page.content = 'I am an aspiring WordPress and Python developer.'
page.post_status = 'publish'
page.id = client.call(posts.NewPost(page))
page.content = 'I am a WordPress and Python developer.'
client.call(posts.EditPost(page.id, page))
我並不特別需要任何復雜的東西,我只是希望得到一個簡單的python腳本,在我學校的博客上創建一個簡單的帖子。
任何有關我的示例無法正常工作的幫助,或任何其他可行的示例都非常感謝。
謝謝!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.