This is the home page of Whiffle, a Python package to hide the complexities of using the Wikidot XML-RPC API.

Example scripts are provided for re-parenting pages and changing tags in large batches.


Whiffle is a normal Python package and is held on the PyPI repository. It can be installed using *pip* or any other method of your choice. If you know what I'm talking about then you don't need me to hold your hand.

If you are new to Python or installing packages from PyPI, then the easiest way is to install Whiffle is manually.1

Download the Whiffle library from here: http://pypi.python.org/pypi/Whiffle
Extract all the files into an empty folder.
From a command prompt in that folder, give the command
python setup.py install

Using Whiffle

The first thing you need to do is to configure the "identity.ini" file. This file must be in the current directory when an application that uses whiffle executes. There is a skeleton in the bin folder that you can use to get started.

The identity.ini file

This heading allows you to have multiple identities and sites. Until you want to do two things at once, leave it alone. The "@wikidot" and the brackets must be there, but you can change the name ("default").
user: AWikidotUserName
This is the Wikidot username that has API access to the site
key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
This is the API key of the wikidot user
site: AWikidotSiteName
This is the Wikidot site that you are working on. It's just the name, no "http" or "wikidot.com".

The Examples

Once you have set up the identity.ini file, look at the examples: addtag.py and chparent.py in the bin sub-folder of the installation folder. These are probably the best way to get started and may be all you need.


Usage: addtag.py [options] page [tag]

Adds or removes tags from Wikidot pages.


Usage: chparent.py [options] parent child

Changes the parent of a page

Using Whiffle in your own application

Each program should include the following::

    from whiffle import wikidotapi, ApiError, SemanticError
    api = wikidotapi.connection(identity)

The parameter to wikidotapi.connection() is optional, and it defaults to "default", which is the identity used in the skeleton identity.ini file.

Calls can then be made on the methods of the "api" object. See the example code for the syntax.

Hello World

Here is the Whiffle version of Hello World:

    from whiffle import wikidotapi

    api = wikidotapi.connection()
    api.set_page_item("hello", "source", "**Hello World!**", create=True)

That creates the page "hello" and puts the text "Hello World!" on it in bold.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License