User:Legobot/PythonWikiBot

PythonWikiBot is a bot framework written in Python. The source is released under the MIT License and is avalible here. It is largely based off the PyWikipediaBot framework, except it uses MediaWiki's native API. It is recommended that you have Python 2.6.2 installed, however it may work with 2.5.4+. It is not compatible with Python 3.0. You should have experience with coding in Python. A good guide can be found on Wikibooks.

How to make your own bot
The PythonWikiBot framework greatly speeds up the process of coding and setting up a bot. However, actually coding or writing a bot is only one part of developing a bot. The first step on the road to creating a bot should involve you reading this guide. Before you make any proper edits, ensure that your bot follows Wikipedia's bot policy and has a proper BRFA approved by a member of the Bot Approvals Group. Failure to comply with the policy may lead to your bot failing to be approved or being blocked from editing Wikipedia.

As for using PythonWikiBot to code your bot, here is a step-by-step process.
 * 1) Downloading
 * 2) Using Subversion, checkout a copy of the source code into a directory where your scripts will go.
 * 3) Or, download a release from here and unzip it.
 * 4) Generate your user configuration.
 * 5) Add the environment variable PYTHONWIKIBOT.
 * 6) *Edit your
 * 7) *Add the line
 * 8) * Make sure you login when given the option.
 * 9) Create a new .py file (e.g. MyBot.py). This is where you write your script.''
 * 1) Create a new .py file (e.g. MyBot.py). This is where you write your script.''

Example code
Here are the basics of writing code with PythonWikiBot. You can see a automatically generated version here.

Bare code
You need to add this at the top of each file. The first line refers to where python is actually found. On Mac OS X and Linux it is usually found at  or.

Getting a page
To get a page and print it, you would use the following.

Editing pages
To edit a page, you would use the following.

Questions, comments

 * Any bugs should be reported at PythonWikiBot's bug tracker here.
 * If you have a bugfix, patchs can be posted at the bug tracker.
 * If you do want commit access to PythonWikiBot's repository, open up a new bug.
 * Translation requests or family additions can be submitted at the bug tracker.
 * If you need help or want to do any of the above and you don't have a google account, leave me a message at my talk page.