Pywikipediabot/user-config.py
From Meta, a Wikimedia project coordination wiki
generate_user_files.py.Subversion repository of wikimedia has the file:
Contents |
[edit] Configuration
Before you run any of the programs, you need to create a file named user-config.py in your pywikipedia directory. You can create it manually (it needs at least two or three variables configured, see below) or run the script generate_user_files.py by typing python generate_user_files.py in the command line shell and hit ENTER. That helps to complete this process.
[edit] For Wikimedia projects
Open a text editor (e.g. Notepad in Windows) and save the text file as user-config.py, in the pywikipedia folder.
Add the following lines to user-config.py:
| Code | Explanation |
family = 'wikipedia' mylang = 'en' |
xx is the code for the language code you are working on, "en" is English[1]. Family is the project name[2]. |
usernames['wikipedia']['en'] = u'ExampleBot' |
Your In this example, the user is working on English Wikipedia, and has created a bot account with the username "ExampleBot". |
|
(Optional) usernames['wikipedia']['de'] = u'BeispielBot' usernames['wikipedia']['en'] = u'ExampleBot' usernames['wiktionary']['de'] = u'BeispielBot' |
(Optional) If you are working on more than one Wikimedia project, you can also add several usernames. |
|
(Optional) console_encoding = 'utf-8' textfile_encoding = 'unicode_escape' |
(Optional, and rarely needed) If this is the encoding used by your system. Always try without first. |
Now save user-config.py again.
[edit] For non-Wikimedia wikis
- Main Page: Pywikipedia bot on non-Wikimedia projects
[edit] Notes
- ↑ If you want to work with more than one language, choose the most common one. You can override this on the command line by using
-lang:zhparameter. - ↑ Meta uses 'meta' for both language code and wiki family; Commons uses 'commons' for both. You can override this on the command line by using
-family:wikibooks. - ↑ The 'u' in front of the username stands for Unicode. The 'u' is required if your username contains non-ASCII characters.