Python Wordpress-XMLRPC:ServerConnectionError:

时间:2014-02-12 17:22:09

标签: python wordpress

我是一个python newb所以请原谅我。我在谷歌和SA上搜索过但找不到任何东西。无论如何,我正在使用python库Wordpress XMLRPC

myblogmyusernamemypassword只是占位符,可隐藏我的真实网站,用户名和密码。当我运行代码时,我使用我的真实数据。

我的代码:

from wordpress_xmlrpc import *
wp = Client('http://www.myblog.wordpress.com/xmlrpc.php', 'myusername', 'mypassword')

错误:

Traceback (most recent call last):
  File "C:/Python27/wordpress_bro", line 2, in <module>
    wp = Client('http://www.myblog.wordpress.com/xmlrpc.php', 'myusername', 'mypassword')
  File "build\bdist.win32\egg\wordpress_xmlrpc\base.py", line 27, in __init__
    raise ServerConnectionError(repr(e))
ServerConnectionError: <ProtocolError for www.myblog.wordpress.com/xmlrpc.php: 301 Moved Permanently>

当我在浏览器中转到http://www.myblog.wordpress.com/xmlrpc.php时,我得到:

XML-RPC server accepts POST requests only.

有人可以帮助我吗?

谢谢!

2 个答案:

答案 0 :(得分:0)

当我使用wordpress_xmlrpc时,我收到了同样的错误。我有一个.htaccess文件,它将http流量重定向到https。这导致301 Moved Permanently错误。

我的&#34;让它工作,以后更好地解决它&#34;解决方法是在我的.htaccess文件中注释掉重定向,然后在我完成时将其重新添加。

答案 1 :(得分:-1)

尝试将“s”添加到http字符串中,例如:

wp = Client('https://www.myblog.wordpress.com/xmlrpc.php', 'myusername', 'mypassword')