Manual:Pywikipediabot/login.py

From MediaWiki.org
Jump to: navigation, search
Bug blank.svg
Subversion repository of Wikimedia has this file:
Pwb icon.svg
Pywikipediabot
scripts
Quick overview
Quick Start Guide
Installation (Mac)
user_config.py

Wikidata
Non-Wikimedia wikis
Basic use
Scripts
Development
Further help

v  d  e

In other languages: it, ca

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.

Contents

Logging in as a bot [edit]

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 [edit]

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.

login.py -all -pass

will login on all projects in user-config.py, using the same password for all.

Global arguments available for all bots

arg Description Default trunk rewrite
-dir:PATH Read the bot's configuration data from directory given by PATH, instead of from the default directory.
-lang:xx Set the language of the wiki you want to work on, overriding the configuration in user-config.py. xx should be the language code. user-config.py parameter: mylang
-family:xyz Set the family of the wiki you want to work on, e.g. wikipedia, wiktionary, commons, wikitravel, …. This will override the configuration in user-config.py settings. user-config.py parameter: family
-user:xyz Log in as user 'xyz' instead of the default username.
-daemonize:xyz Immediately return control to the terminal and redirect stdout and stderr to xyz (only use for bots that require no input from stdin).
-help Show a help text for the invoked script.
-log Enable the logfile. Logs will be stored in the logs subdirectory. user-config.py parameter: log ?
-log:xyz Enable the logfile, using xyz as the filename.
-nolog Disable the logfile (if it's enabled by default).
-maxlag Sets a new maxlag parameter to a number of seconds. Defer bot edits during periods of database server lag. Default is set by config.py
-debug:item
-debug
Enable the logfile and include extensive debugging data for component "item" (for all components if the second form is used).
-putthrottle:nn
-pt:nn
Set the minimum time (in seconds) the bot will wait between saving pages. user-config.py parameter: put_throttle ?
-verbose
-v
Make the program output more detailed messages than usual to the standard output about its current work, or progress, while it is proceeding. This may be helpful when debugging or dealing with unusual situations. not selected


See also [edit]