Manual:Pywikibot/user-config.py

Configuration
Before you run any of the programs, you need to create a file named user-config.py in your pywikipedia directory either one of two ways:
 * 1) Create the file manually (it needs at least two or three variables configured, see below) or
 * 2) run the script pwb.py by typing   in the command line shell and hit ENTER (which will interactively generate the file in an interactive "wizard" style).

(Alternatively, user-config.py can be located in a directory specified with a -dir: argument when a pywikipedia script is called, or specified by the PYWIKIBOT_DIR environment variable, or in the directory where a script is run.)

Below are the instructions for editing manually the content of the file.

For Wikimedia projects
Open a text editor (e.g. Notepad in Windows) and save the text file as, in the pywikipedia folder.

If your language uses non-ASCII characters, you should use a Unicode-aware editor such as Notepad++ and save your user-config with Unicode encoding without BOM marks. Don't forget to insert into the first line.

Add the following lines to :

Now save  again.

EksempelBot on no.wikipedia
mylang = 'no' usernames['wikipedia']['no'] = u'EksempelBot'

console_encoding = 'utf-8' use_api_login = True

ExampleBot on Commons
mylang = 'commons' family = 'commons' usernames['commons']['commons'] = u'ExampleBot'

console_encoding = 'utf-8' use_api_login = True

ExampleBot on Test
mylang = 'test' family = 'test' usernames['test']['test'] = u'ExampleBot'

console_encoding = 'utf-8' use_api_login = True

BeispielBot on de.wikipedia and de.wikibooks, with de.wikipedia as main wiki
mylang = 'de' usernames['wikipedia']['de'] = u'BeispielBot' usernames['wikibooks']['de'] = u'BeispielBot'

console_encoding = 'utf-8' use_api_login = True

For non-Wikimedia wikis

 * Main Page: Manual:Pywikibot/Use on third-party wikis