![]() |
| XMLRPC 'client' error - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: XMLRPC 'client' error (/thread-11302.html) Pages: 1 2 |
XMLRPC 'client' error - SamLearnsPython - Jul-02-2018 I'm trying to create a wordpress post through XMLRPC but getting this error (env) sam@sam-H81M-S ~ $ python3 Python 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from wordpress_xmlrpc import Client, WordPressPost >>> from wordpress_xmlrpc.methods.taxonomies import * >>> from wordpress_xmlrpc.methods.posts import * >>> from wordpress_xmlrpc.methods.users import * >>> from wordpress_xmlrpc.methods import * >>> wp_url = '``http://localhost/wordpress``' >>> wp_username = 'admin' >>> wp_password = ' ######## ' >>> post = WordPressPost() >>> post.title = 'My Post' >>> post.content = 'This is content' >>> post.id = client.call(posts.NewPost(post)) When I use Client I get this error instead RE: XMLRPC 'client' error - gontajones - Jul-02-2018 I think you have to create a Client object and then use the call() method. wp_url = '``http://localhost/wordpress``' wp_username = 'admin' wp_password = ' ######## ' wp = Client(wp_url, wp_username, wp_password) post = WordPressPost() post.title = 'My Post' post.content = 'This is content' post.id = 1 wp.call(WordPressPost(post)) RE: XMLRPC 'client' error - SamLearnsPython - Jul-02-2018 Getting this error RE: XMLRPC 'client' error - gontajones - Jul-02-2018 I think this error occurs because of the XML-RPC is not running on target machine. RE: XMLRPC 'client' error - SamLearnsPython - Jul-02-2018 But it's telling me its already installed? sam@sam-H81M-S ~ $ python3 -m venv env sam@sam-H81M-S ~ $ source ./env/bin/activate (env) sam@sam-H81M-S ~ $ pip install python-wordpress-xmlrpc Requirement already satisfied (use --upgrade to upgrade): python-wordpress-xmlrpc in ./env/lib/python3.5/site-packages You are using pip version 8.1.1, however version 10.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. (env) sam@sam-H81M-S ~ $ RE: XMLRPC 'client' error - gontajones - Jul-02-2018 Have you started the XML-RPC server on your server (localhost)? Plugin xml-rpc-modernization From Overview Quote:Create an instance of the Client class with the URL of the WordPress XML-RPC endpoint and user credentials. Then pass an XmlrpcMethod object into its call method to execute the remote call and return the result. You'll have to address wp_url to something like http://localhost:port/xmlrpc.php. RE: XMLRPC 'client' error - SamLearnsPython - Jul-03-2018 Both the XMLRPC documentation page and Wordpress documentation page state Quote:XML-RPC functionality is turned on by default since WordPress 3.5. In previous versions of WordPress, XML-RPC was user enabled This is the output for localhost:port/wordpress/xmlrpc.php Quote:XML-RPC server accepts POST requests only. RE: XMLRPC 'client' error - gontajones - Jul-03-2018 That's good. Have you tried with this URL? wp_url = "http://localhost:PORT_NUM/wordpress/xmlrpc.php" wp_username = 'admin' wp_password = ' ######## ' wp = Client(wp_url, wp_username, wp_password) post = WordPressPost() post.title = 'My Post' post.content = 'This is content' post.id = 1 wp.call(WordPressPost(post))Check these Several Examples RE: XMLRPC 'client' error - SamLearnsPython - Jul-03-2018 Nope still didnt work (env) sam@sam-H81M-S ~ $ python3 Python 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from wordpress_xmlrpc import Client, WordPressPost >>> from wordpress_xmlrpc.methods.taxonomies import * >>> from wordpress_xmlrpc.methods.posts import * >>> from wordpress_xmlrpc.methods.users import * >>> from wordpress_xmlrpc.methods import * >>> wp_url = "http://localhost:PORT NUM/wordpress/xmlrpc.php" >>> wp_username = 'admin' >>> wp_password = '######' >>> wp = Client(wp_url, wp_username, wp_password) RE: XMLRPC 'client' error - gontajones - Jul-03-2018 You need to put your port number in the URL. How did you install the wordpress on your machine? Test with the HTTP standard port: >>> wp_url = "http://localhost:80/wordpress/xmlrpc.php"Or >>> wp_url = "http://localhost/wordpress/xmlrpc.php" |