如何用python wordpress xmlrpc修复错误?

2024-09-30 10:42:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用python库Wordpress\uxmlrpc更新我的Wordpress站点上的一篇博客文章。当我去www.myactualdomaingoeshere.com/xmlrpc.php,我得到“XML-RPC服务器仅接受POST请求”。这似乎表明允许XMLRPC请求,但当我运行下面的简单代码段时,我得到了错误。你知道吗

已尝试将客户端方法的链接输入更改为http、https、trailing/等。似乎没有任何效果。你知道吗

from wordpress_xmlrpc import Client
from wordpress_xmlrpc import WordPressPost
from wordpress_xmlrpc.methods import posts
from wordpress_xmlrpc.methods.posts import EditPost

url = 'http://www.myactualdomaingoeshere.com/xmlrpc.php'
user = 'myusername'
password = 'mypassword'

client = Client(url, user, password)
posts = client.call(posts.GetPosts())

预期:任何电话客户端呼叫具有有效wordpress方法的将按预期运行。 实际:协议错误www.myactualdomaingoeshere.com/xmlrpc.php:301永久移动


Tags: 方法fromimportcomclienthttp客户端www

热门问题