Manual:Pywikibot

The Python Wikipediabot Framework is a set of bots to do things on Wikipedia or other Mediawiki projects. It has been written by several people using the language Python. On this page, we give the general information for people who want to use the bots.

Downloading
To use the bot you will have to download the bot as well as Python.

Python is already present on some distributions of Unix, and need not be included then (although it might be necessary to update it if you have a very old version). In all other cases, it can be found at http://www.python.org/download/. Python can be run on all common platforms (Unix, Linux, Mac, Windows). Download and install Python.

The bot itself can be found at Sourceforge. At http://sourceforge.net/projects/pywikipediabot/ you can download it as a package, but this is often an outdated version. A much more up-to-date version (at most ca. 24 hours old) can be found at http://cvs.sourceforge.net/viewcvs.py/pywikipediabot/pywikipedia/, but that requires one to download every file separately. In the long run, the best method would be to use CVS. On Unix this is I think standard, for Windows TortoiseCVS is advised. You will also need a login at sourceforge, and contact the developers of the bot. I am not going to give a more extensive description, last time I tried to guide someone through I failed :-0

Once you have the bot, all you have to do is put it somewhere on your computer, it does not need any further installation.

If you plan to use the bot, it is probably a good thing to subscribe to the bot mailing list (see ). Every time a file of the bot is changed, a mail is sent to the list, so you know when you need to upload a new version.

Preparation
Make sure that your bot is approved by the community at the wiki you are going to use it. Strictness of this is much differing between various projects; at some you need to announce it in advance and get approval before you start, at others you can do whatever you want.

Using your normal browser, create a login name and password for the Bot. It is best to use a name that makes clear that it is a bot, and preferably also who is operating it. A common method is to use your own login name and add the word 'bot' to it, but several other forms also exist.

Next, in the bot directory, create a file "user_config.py" with the following lines: mylang = 'xx' username = 'MyBot' xx here is the code for the language you are working on (if you want to work on more than one language, choose the most common one, and read pywikipediabot general parameters to see how to work on other languages). If you are NOT working on wikipedia, you should also add: family = 'familyname' where familyname is the name of the site you're working on. Currently, this can be wiktionary, wikibooks, wikiquote or wikitravel. If you work on commons you can choose to either specify it as the language or both as the language and the family.

Really getting started
Now we are ready to really start using the bot. You need to get to a textual interface to your OS. On Windows this is done by opening the start menu, and clicking on 'Run'. You are asked to give the name of a program, choose "cmd.exe".

Go to the directory where you saved the files of the robot (using the command "cd"). You can now run any of the bots here by simply typing "botname.py" (in Windows only) or "python botname.py" (all systems).

Before actually starting to work, run the bot login.py. It will ask for a password, use the password you used for the bot's login name. If you do not do this, the bot will make all its edits anonymously, which is considered obnoxious to those who are checking for vandalism. You normally need to only run this program once, the bot usually does not get logged off.

And now? Now you can use one of the bots. Below is a list of the existing bots with sometimes links to their descriptions:

Main bots: Other bots: Auxiliary programs:
 * category.py
 * check_extern.py
 * interwiki.py
 * redirect.py
 * replace.py
 * solve_disambiguation.py
 * table2wiki.py
 * upload.py
 * brackethttp.py
 * catall.py
 * copy_table.py
 * editarticle.py
 * find.py
 * getimages.py
 * imageharvest.py
 * imagetransfer.py
 * pagelist.py
 * saveHTML.py
 * standardize_interwiki.py
 * touchall.py
 * us-states.py
 * warnfile.py
 * extract_names.py
 * extract_wikilinks.py
 * login.py
 * splitwarning.py
 * sqldump.py
 * template.py
 * test.py
 * xmltest.py

Registering as a bot
If you heavily use a bot, it will clutter recentchanges. To avoid that, you can get your bot registered as such. In that case it will not be shown on Recent changes unless a user specifically asks to get bots included.

This can only be done by a Steward. You can put a request to get your or someone else's bot registered at Requests for permission. You will probably be asked for some kind of evidence that your local community agrees with your bot. It is probably good to get your bot registerd whenever it will edit many pages in a single run.

Advanced bot use
If you have a function you want to have a bot for that is not yet provided by one of the bots, you can ask one of the programmers to write it for you. Or even better, you can try to work on the bots yourself. Python is a nice language, and not hard to learn. We will welcome you.