Skip to content

Python WordPress xmlrpc’s

As we know python is very easy languages and by the help of that you can easily create cloud application. But are you know that by the help of python you can control WordPress. Yes By the help of python you can control WordPress, which is written in php (hypertext preprocessor) Languages. From Few days i was trying to collapse these both things and finally i found that yes we can do this by the uses of XML-RPC interface and this is python library which help us to interface with WordPress blog.

Python WordPress

WordPress has its own implementation for WordPress-specific functionality in an API called the WordPress API. This should be used when possible, and your client should use the API variants beginning with the wp prefix.

WordPress also supports the Blogger API, metaWeblog API.


In WordPress 3.5+, the XML-RPC API is enabled by default and cannot be disabled.
In WordPress 0.70-3.42, the XML-RPC API is disabled by default. To enable it, go to Settings->Writing->Remote Publishing and check the box for XML-RPC.

Getting Started

    • Installation
    • Working For Post


  • Check your WordPress Version, If your WordPress Version is 3.4 and less than this so please enable your XML-RPC by upper note second point method.
  • When you complete first part of this installation then use this command or process according to your system(OS)


For best results, uninstall previous versions FIRST (see Uninstalling).

Using Windows 8 (which includes PowerShell 3) or earlier versions of Windows with PowerShell 3 installed, it’s possible to install with one simple Powershell command. Start up Powershell and paste this command:

> (Invoke-WebRequest | python -

You must start the Powershell with Administrative privileges or you may choose to install a user-local installation:

> (Invoke-WebRequest | python - --user

If you have Python 3.3 or later, you can use the py command to install to different Python versions. For example, to install to Python 3.3 if you have Python 2.7 installed:

> (Invoke-WebRequest | py -3 -

The recommended way to install setuptools on Windows is to download and run it. The script will download the appropriate distribution file and install it for you.

Once installation is complete, you will find an easy_install program in your Python Scripts subdirectory. For simple invocation and best results, add this directory to your PATH environment variable, if it is not already present. If you did a user-local install, the Scripts subdirectory is$env:APPDATA\Python\Scripts.

Windows 7 and lower version

For Windows without PowerShell 3 or for installation without a command-line, download using your preferred web browser or other technique and “run” that file.


Install from PyPI using

easy_install python-wordpress-xmlrpc


pip install python-wordpress-xmlrpc.


Create an instance of the Client class with the URL of the WordPress XML-RPC . Then pass an XmlrpcMethod object into its call method to execute the remote call and return the result.

>>> from wordpress_xmlrpc import Client, WordPressPost
>>> from wordpress_xmlrpc.methods.posts import GetPosts, NewPost
>>> from wordpress_xmlrpc.methods.users import GetUserInfo

>>> wp = Client('', 'username', 'password')


>>> post = WordPressPost()
>>> post.title = 'My new title'
>>> post.content = 'This is the body of my new post.'
>>> post.terms_names = {
>>>   'post_tag': ['test', 'firstpost'],
>>>   'category': ['Introductions', 'Tests']
>>> }

There are lot’s of other methods by which you can manipulate the WordPress by using python XML-RPC library. 🙂


As you see that this very easy process by which you can control your WordPress as a remote server without any difficulties. Here i explain a single method but there are lots of other method like post, pages, Category etc.. 🙂

Previous article

Python for Beginners

Next article

Intro Firefox OS & APP Part 1

Join the discussion

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: