Manual:Speed guide for pywikipediabot

From Botwiki

Jump to: navigation, search
Disclaimer and warning:

All out of control bots will be blocked immediately on this website (sorry, on this project we don't assume good faith :P).

Remember that there's not any bugfree Bots, Script or Regex so there may be errors so Be careful! AND

If you aren't sure of what you're doing, AVOID USING A BOT!
If you have any questions you can ask me here.
  • First: Download and Install Python.
  • Decompress the folder pywikipedia found at this address, there is pywikipedia-nightly.tar.bz2 (also .zip or .rar version). If you're running Windows, put the pywikipedia folder directly on your Hard Disk, so the right path should be "C:\pywikipedia" (How to: Click "My Computer", then click "C drive").
  • Go on Wikipedia (or any Wikimedia Project) and register an account with your Bot's name (for example, NAMEbot)
  • This passage is optional but suggested:
    • Windows: click start → programs → python and choose 'python (command line)'.
    • On Linux just open the shell and type python.
    • For windows and Linux, write (without ") "import sys" then click enter and "print sys.stdout.encoding" and enter again.
    • Python will write console_encoding on the screen (So replace it with 'utf-8' in the following step).
  • Go to the pywikipedia folder, open your text editor (the ones for .txt files) and cut and paste:
mylang = 'en'
family = 'wikipedia'
usernames['wikipedia']['en'] = 'NAMEBot'
console_encoding = 'utf-8'
use_api = True
That's the settings for en.wikipedia, for commons you have to replace "en" and wikipedia with "commons" or if your language is not English you have to replace en with fr (for example) and so on.
Replace 'NAMEBot' with the name of your bot, then go to 'save with name' then 'save as' and you have to select 'all the files' and in the name you have to write 'user-config.py' and you finally put the file into the pywikipedia folder.

(For more details look here If there is a problem, replace in the console_encoding 'utf-8' with'cp850' or with 'iso-8859-1')

This image explain a lot, click to make it bigger.
This image explain a lot, click to make it bigger.
  • After completing all the previous operations, click on "start", "execute" and then cmd in the windows to open a DOS screen (on linux you have only to open the shell). Navigate to reach your pywikipedia folder, so if you have put the folder in the previous path, write: cd C:\pywikipedia (or for example cd /home/user/Desktop/pywikipedia if you have linux). cd is a DOS command that means "Change Directory" and it's used to "navigate with the DOS" (and you have to go in your pywikipedia folder every time that you have to use your bot).
  • Now you have to log in your bot, so write: login.py (in the DOS windows) or python login.py if you have linux or Mac. If you do that the program will ask you your password, write it (please note that nothing will appear due to privacy issues). Please also note that this login part won't be done again (if you don't change the password) because the bot will store the cookie not to bother you every time asking for the password.
  • Then you can start to use the bot, for example by running simple regex to replace some text (for example, '[[USA]]' -> '[[United States|USA]]') and so on. To do that you can open the files on the framework and read the instructions, they will be easy enough to understand (or I hope so). I would suggest you to start with replace.py because it's the script for the regex that I've said above.
  • Last thing, you have to request the bot status, for en.wikipedia you have to ask here (if you don't find the equivalent on your project try to ask on IRC or on your project's bar) otherwise the Administrators will block immediately the Bot (be careful!).
  • {NB!} If you want to stop the Bot, select the DOS windows or the shell (if already selected, it's useless) and digit ctrl+c" (holding them at the same time).

{NB!} For your Bot page you can see mine on commons and for more infos and commands you can read the official guide: Using the python wikipediabot.

If you have problems to create the bot you can find use also here:

  1. #pywikipediabot @ irc.eu.freenode.net international channel
  2. #botolatori @ irc.eu.freenode.net italian irc-channel

[edit] Set the Bot for Botwiki

The pywikipedia software can be used to run Bots also in non-Wikimedia Projects (like that one). By the way, we are lucky because Misza13 has added the family file for botwiki to help as ;-)

Here the are the parameters:

mylang = 'botwiki'
family = 'botwiki'
usernames['botwiki']['botwiki'] = 'NAMEBot'
console_encoding = 'utf-8'
use_api = True

Enjoy ;-) --Filnik 14:10, 2 February 2008 (UTC)

Personal tools