From Event-B
Jump to navigationJump to search

A bot may be a useful tool to help a wiki maintenance.

I tried to use the python framework provided by Hereafter are some guidelines to make it work on this wiki.


  • Python >2.5

Getting pywikipedia framewok

Get the source code from subversion:

(prompt) svn co pywikipedia

Configuring the framework for this wiki

Add the following families/ file (be careful with the indentation):

# -*- coding: utf-8  -*-

import family
# The event-b family
# usernames['event-b']['event-b'] = 'User name'
class Family(family.Family):
    def __init__(self):
        family.Family.__init__(self) = 'eventb'
        self.langs = {
            'eventb': '',

        self.namespaces[4] = {
            '_default': [u'Event-B', self.namespaces[4]['_default']],

        self.namespaces[5] = {
           '_default': [u'Event-B talk', self.namespaces[5]['_default']],

    def version(self, code):
        return '1.12'

    def path(self, code):
         return '/index.php' #The path of index.php, look at your wiki address. 

    def scriptpath(self,code):
        return ''
#    def shared_image_repository(self, code):
#        return ('commons', 'commons')

Then add the following file:

usernames['eventb']['eventb'] = 'your_bot_user_name'



First you should log in:

(prompt) python 

Upload Images

(prompt) python -noverify -keep file.png "Image description"

For uploading several images from a directory, I use the following sh command:

for i in /tmp/imagedir/* ; do (yes | python -v -noverify -keep $i "Import of image $i"); done

Add a category to the last uploaded images

For the last 20 images, do :

python -v add -newimages:20

Replace text matching regular expressions

python -cat -regex '{\\tt ([^}]*)}' '\texttt{\1}'

Rename a category

python move -from:"Template" -to:"Templates" -batch -putthrottle:6