User:Sikon/Pywikipedia

To configure the Pywikipedia bot toolkit:
 * Install Python version >=2.3. (python.org)
 * Download and extract pywikipedia (sf.net/projects/pywikipediabot)
 * Create a file called user-config.py in the root directory (where the config.py file resides) and insert:

import os, re, sys family = 'starwars' mylang = 'en' usernames['starwars']['en'] = 'bot username' minthrottle = 1 maxthrottle = 2 put_throttle = 2 noisysleep = 1.0

The throttle values regulate how long the bot will wait between getting and saving pages.


 * Create a file called starwars_family.py in the families directory with the following content:

import family class Family(family.Family): def __init__(self): family.Family.__init__(self) self.name = 'starwars' self.langs = { 'en': None, }       # Most namespaces are inherited from family.Family. self.namespaces[4] = { '_default': u'Wookieepedia', }       self.namespaces[5] = { '_default': u'Wookieepedia talk', }       # A few selected big languages for things that we do not want to loop over # all languages. This is only needed by the titletranslate.py module, so       # if you carefully avoid the options, you could get away without these # for another wiki family. self.languages_by_size = ['en'] def hostname(self,code): return 'starwars.wikicities.com' def path(self, code): return '/index.php' def version(self, code): return "1.5"


 * In wikipedia.py, find the following text:

def getToken(self, getalways = True, getagain = False, sysop = False):

Just after it, replace "Wikipedia:Sandbox" with "Template:Stub" (or any other page that exists on Wookieepedia).


 * Now try running some scripts. A summary on command line options is present in the .py files themselves.

Some example commands used by R2-D2 so far:

python replace.py -cat:Core_planets "=Unknown" "="
 * implementing auto-hiding in planet infoboxes by removing the "Unknown" text (repeated for "Core planets", "Colonies planets", "Tapani Sector planets" and "Planets"):

python category.py move
 * moving categories (category names were input at prompt):


 * fixing template categories with a modified version of catall.py (with the noinclude notation support).