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 no such thing as a bugfree Bot, Script or Regex so there may be errors 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 us here.
  • First: Download and Install Python release 2.7.2. If you have a Mac, OS X comes with python and you probably already have 2.6, that may work but is not recommended, you should upgrade.
  • 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) if you haven't already done so.
  • This passage is optional but suggested:
    • Windows: click start → programs → python and choose 'python (command line)'.
    • On Mac or 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 link building write '' 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.
  • 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: (in the DOS windows) or python 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. However, you need to know the local rules for bots. On nearly every project you can run your bot in your own userspace and the bot's userspace at 30-60 seconds or more between edits without any problem; however, many projects require you to request a bot flag before you do so and some, such as the English Wikipedia have a very formal process for doing this (see here).
  • To test your bot you can, for example by run a simple regex to replace some text (for example, '[[USA]]' -> '[[United States|USA]]'). To do that you can open the files on the framework and read the instructions, they will be easy enough to understand. We suggest you start with because it's the easiest script to use with regex but it's also the most versatile and can do many of the task that other more specialized scripts do.
  • {NB!} If you want to stop the Bot, select the DOS window or the shell and type ctrl+c" (holding them at the same time). (Note, for some processes, such as import, this might not stop the process)

{NB!} For your Bot page you can see this one: on commons and for more info and commands you can read the official guide: here.

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

  1. #botwiki botwiki international channel
  2. #botolatori bowiki Italian channel
  3. #pywikipediabot pywikipediabot international channel
  4. #botolatori @ italian irc-channel

Set the Bot for Botwiki

The pywikipedia software can be used to run Bots also in non-Wikimedia Projects (like this one). Although a botwiki family file may have been included in pywikipediabot, it is likely out of date and it is best to use to create a new one.

Personal tools