Manual:Pywikibot/login.py

login.py is the python program that logs the user running the pywikipedia bot on to the system using the data that can be found in user-config.py.

Login as a bot
Bots provide specified result and as a consequence, they should not need the attention that other changes require. By having a specific user to run the bot software, the changes created in this way will be hidden on a typical recent changes screen. Bot status is given when a community is in favour with someone running a bot.

If you want to login also with your sysop account (deleting moved categories...) you have to add sysopnames['wikiproject']['languagecode'] = u'YourSysopUsername' to user-config.py and start login.py with the -sysop parameter

How it knows where to login
In the user-config.py file there are three components:
 * 1) the language: mylang
 * 2) the family: family - this indicates wiki name, including wikipedia or wiktionary
 * 3) 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 -all can be used, and if the same password is used throughout all these projects, it can be combined with -pass so that the program doesn't ask for a password for each site. python login.py -all -pass will login on all projects in user-config.py, using the same password for all.

Logout
python pwb.py login -logout

Login using OAuth
Pywikibot supports login using OAuth authentication instead of password. The OAuth feature needs the site with Extension:OAuth installed and configured properly.

Option -oauth enables OAuth authentication tokens fetching process. python login.py -oauth The process contains the following steps:
 * 1) Input OAuth consumer key
 * 2) Input OAuth consumer secret
 * 3) Authenticate user via web brower. You may need to manually copy the url from the terminal if the web brower doesn't open up automatically.
 * 4) Input response query string to terminal when authentication succeeds.
 * 5) Copy and paste authentication entry generated into user-config.py.

NOTE: -logout, -pass, -force, -pass:XXXX and -sysop are not compatible with -oauth</tt>.