From ff7e66ba68e738548432791d4507a524e577a27e Mon Sep 17 00:00:00 2001 From: Frances Hocutt <frances.hocutt@gmail.com> Date: Mon, 3 Nov 2014 13:19:22 -0800 Subject: [PATCH] Added instructions for changing default user-agent Added instructions and an example for changing the default user-agent, as in: https://meta.wikimedia.org/wiki/User-Agent_policy . --- README.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.rst b/README.rst index 2512de6..8b6f3d1 100644 --- a/README.rst +++ b/README.rst @@ -98,6 +98,19 @@ HTTPS To use https, specify the host as a tuple in the form of ``('https', hostname)``. +User-agents +----------- +Bots that run on Wikimedia wikis `require an informative user-agent for all +API requests <https://meta.wikimedia.org/wiki/User-Agent_policy>`. To change +the user-agent, you will need to include an appropriate parameter for +``clients_useragent`` when you initialize your ``Site``, as shown in the +following example: + +.. code-block:: python + useragent = 'YourBot, based on mwclient v0.6.5. Run by User:You, you@gmail.com' + site = mwclient.Site(('https', 'en.wikipedia.org'), clients_useragent=useragent) + + Example ------- -- GitLab