Skip to content
Snippets Groups Projects
Commit ff7e66ba authored by Frances Hocutt's avatar Frances Hocutt
Browse files

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 .
parent 90ddfd0a
No related branches found
No related tags found
No related merge requests found
...@@ -98,6 +98,19 @@ HTTPS ...@@ -98,6 +98,19 @@ HTTPS
To use https, specify the host as a tuple in the form of ``('https', hostname)``. 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 Example
------- -------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment