Manual:Pywikibot/BotPasswords/fr

En tant qu'alternative plus simple (mais moins sûre) à MediaWiki OAuth, cela permet aux utilisateurs de bots d'utiliser des mots de passe de bot pour limiter les autorisations accordées à un bot.

En utilisant BotPasswords, chaque instance reçoit un login_name de la forme et un mot de passe. Cette combinaison permet uniquement d'accéder à l'API, et non à l'interface web normale.

Prérequis

 * Le wiki sur lequel vous souhaitez utiliser le bot doit être équipé de MediaWiki > 1.27.
 * In most installations, the client software should be configured to use  protocol.
 * Though logins may initially appear to work, the generated cookie appears incomplete and pywikibot actions relying on rights will fail. Refer to T150645.

Configuration

 * Connectez-vous sous votre compte bot (s'il est différent de votre compte principal).
 * Generate a bot password under Special:BotPasswords (or the corresponding page on another wiki):
 * Fill in a 'bot name', which is the suffix which will be added to your username. For example 'replace-on-tools'.
 * Grant the relevant rights. For most Pywikibot scripts High-volume editing, Edit existing pages and Create, edit, and move pages are enough. If you also want to upload files with the bot, include Upload new files and Upload, replace, and move files. Leave the usage restrictions as-is. Click 'create'.
 * You will receive a message like The new password to log in with Valhallasw@my-botpassword-name is mysupersecretbotpassword Do not close this window until you saved the password in your password file (see below)


 * using  script
 * This script can manage for you the creation of a  file. Simply run , and follow the prompts. After the choice of a wiki, and entering your username, you'll be able to enter the name/pass couple created on Special:BotPasswords at the previous step. The name is the one you've chosen, the pass is the one given by the website.


 * or creating  file manually
 * In the directory where your  is, create a file called , and make it unreadable for others
 * In the file user-password.py, add a line
 * In user-config.py, add the line  . Note that you should only have you username in that file and leave out the suffix "@my-botpassword-name".


 * vérifier que la configuration fonctionne
 * Run . Pywikibot should now automatically login using your bot password:

Logging in to meta:meta as Valhallasw@my-botpassword-name Logged in on meta:meta as Valhallasw.

format d'entrées password_file
The entries in  should be tuples with 2, 3, or 4 items:


 * Used when the entry should only be used on a specific, e.g.   or.
 * Used when the entry should only be used on a specific  and , e.g.   and.
 * Used when the entry should only be used on a specific, e.g.   or.
 * Used when the entry should only be used on a specific  and , e.g.   and.
 * Used when the entry should only be used on a specific  and , e.g.   and.