简体   繁体   中英

Python Wordpress-XMLRPC: ServerConnectionError: <ProtocolError 301 Moved Permanently

I am a python newb so please forgive me. I have searched on Google and SA but couldn't find anything. Anyway, I am using the python library Wordpress XMLRPC .

myblog , myusername , and mypassword are just placeholders to hide my real website, username and password. When I run the code I use my real data.

My Code:

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

The Error:

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>

When I go to http://www.myblog.wordpress.com/xmlrpc.php in my browser I get:

XML-RPC server accepts POST requests only.

Could somebody please help me?

Thanks!

I received the same error when I used wordpress_xmlrpc. I had a .htaccess file which redirects http traffic to https. This caused the 301 Moved Permanently error.

My "get it working, to solve it better later" solution was to comment out the redirect in my .htaccess file and add it back in when I'm done.

尝试将“ s”添加到http字符串中。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM