Manual:Pywikibot/User-agent

Pywikibot allows you to have customized user-agent. Prior to August 2014, pywikibot core users needed to change the format string in http.py. Now the default is defined in config2.py as: For example the result will be: login (wikipedia:de; User:Xqbot) Pywikibot/3.1.dev0 (g11348) requests/2.21.0 Python/3.7.0.final.0 This user-agent complies with the Wikimedia User-Agent policy.

As of September 2014, change the user-agent by adding a variable 'user_agent_format' to user-config.py, with a string value using any variable in this table: The Used column indicates whether that value is used by the default user_agent_format string.

If you want to make the current user agent better we suggest you to add more direct contacting information like your e-mail address, etc. Pywikibot sends just the script name and version number when you're requesting a third party wiki (like getting the title of an external link in reflinks.py). We do it since we don't want to expose your contact information to third party websites.

As of July 2019, if you define  config variable, it will be added as a component to   value. This is the recommended way to add contact information to the User-Agent string, e.g. adding to  a setting like: user_agent_description = " https://example.org/CoolTool/ ; CoolTool@example.org" ATTENTION: Anything you add to user agent needs to be a ISO 8859 character, which means even characters like č, š, or ā are unacceptable.