Manual:Pywikibot/login.py/ca

login.py és el programa que ens permet identificar-nos per poder engegar un bot del marc de treball pywikipedia, el sistema emprarà les dades desades al fitxer de configuració anomenat .

Login as a bot
Els bots proveeixen resltats específics i com a conseqüència, no necessiten l'atenció que altres canvis requereixen. Amb l'obtenció d'un compte d'usuari específic per a executar un programari de bot, els canvis efectuats amb ell seran amagats en una pantalla típica dels canvis recents. És la comunitat qui decideix a qui es pot atorgar la marca de bot.

How it knows where to login
In the user-config.py file there are three components:


 * 1) the language: mylang
 * 1) the family: family - this indicates wiki name, including wikipedia or wiktionary
 * 1) the username: username - this can be any user but it should be a user who is registered to run as a bot.

In order to login to all the projects/languages mentioned in user-config.py, the option  can be used, and if the same password is used throughout all these projects, it can be combined with   so that the program doesn't ask for a password for each site.

will login on all projects in user-config.py, using the same password for all. For now, using -pass option is not supported. (T102477) You should use password file instead. Create file with text like '("en", "wikipedia", "User", "password")' (you can use more than one line). Then, insert in your user-config.py file 'password_file = "path_to_password_file"' line. After this Pywikibot should use data from this file when he need to login. You should make user-config.py and password file unreadable for others (chmod 600 user-config.py) before adding secrets to it.

Login using OAuth
Pywikibot supports login using OAuth authentication instead of password. The OAuth feature needs the site with installed and configured properly. OAuth is more secure (passwords are not sent over the internet, can be invalidated at any time, and the permissions of the bot user can be restricted) and should generally be preferred over normal login. See on how to use it (it does not involve login.py).

If for some reason you want to log your bot in as a multi-user OAuth app (not recommended, but e.g. older MediaWiki might not support owner-only apps), you can use login.py for that, with the option. The process contains the following steps:

E.g.: oauth_verifier=xxx&oauth_token=yyy
 * 1) Log into meta as your bot account. Create an OAuth app at   if it does not exist yet, and record the consumer key and secret. Until T323849 is resolved, only version 1.0a is supported
 * 1) Run
 * 1) Input OAuth consumer key
 * 1) Input OAuth consumer secret
 * 1) Authenticate user via web browser. You may need to manually copy the url from the terminal if the web browser doesn't open up automatically.
 * 1) Input response query string to terminal when authentication succeeds.
 * 1) Copy and paste authentication entry generated into .