【问题标题】:Python Wordpress-XMLRPC: ServerConnectionError: <ProtocolError 301 Moved PermanentlyPython Wordpress-XMLRPC: ServerConnectionError: <ProtocolError 301 Moved Permanently
【发布时间】:2014-02-12 17:22:09
【问题描述】:

我是python新手,请见谅。我在 Google 和 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.

有人可以帮帮我吗?

谢谢!

【问题讨论】:

  • 是的,是wordpress.com的问题。如果您自己设置 wordpress 安装,它将起作用。 Wordpress.com 已禁用 XMLRPC。

标签: python wordpress


【解决方案1】:

尝试将“s”添加到 http 字符串中......类似于:

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

【讨论】:

    【解决方案2】:

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

    我的“让它工作,以后更好地解决它”的解决方案是在我的 .htaccess 文件中注释掉重定向,并在我完成后将其重新添加。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-28
      • 2014-07-05
      • 2017-06-13
      • 2014-12-30
      • 2020-10-07
      • 1970-01-01
      • 2012-01-09
      • 2017-01-01
      相关资源
      最近更新 更多