MediaWiki API client
mwclient is a lightweight Python client library to the MediaWiki API which provides access to most API functionality. It works with Python 2.7, 3.3 and above, and supports MediaWiki 1.16 and above. For functions not available in the current MediaWiki, a MediaWikiVersionError is raised.
$ pip install mwclient
The current development version can be installed from GitHub:
$ pip install git+git://github.com/mwclient/mwclient.git
Please see the changelog document for a list of changes.
See the user guide to get started using mwclient.
mwclient ships with a test suite based on pytest. Only a small part of mwclient is currently tested, but hopefully coverage will improve in the future.
The easiest way to run tests is:
$ python setup.py test
This will make an in-place build and download test dependencies locally if needed. To make tests run faster, you can use pip to do an “editable” install:
$ pip install pytest pytest-pep8 responses $ pip install -e . $ py.test
To run tests with different Python versions in isolated virtualenvs, you can use Tox:
$ pip install tox $ tox
Documentation consists of both a manually compiled user guide (under docs/user) and a reference guide generated from the docstrings, using Sphinx autodoc with the napoleon extension. Documentation is built automatically on ReadTheDocs after each commit. To build documentation locally for testing, do:
$ cd docs $ make html
When writing docstrings, try to adhere to the Google style.
Most properties and generators accept the same parameters as the API, without their two-letter prefix. Exceptions to this rule:
- Image.imageinfo is the imageinfo of the latest image. Earlier versions can be fetched using imagehistory()
- Site.all*: parameter [ap]from renamed to start
- categorymembers is implemented as Category.members
- deletedrevs is deletedrevisions
- usercontribs is usercontributions
- First parameters of search and usercontributions are search and user respectively
Properties and generators are implemented as Python generators. Their limit parameter is only an indication of the number of items in one chunk. It is not the total limit. Doing list(generator(limit = limit)) will return ALL items of generator, and not be limited by the limit value. Default chunk size is generally the maximum chunk size.
Release history Release notifications
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash SHA256 hash help||File type||Python version||Upload date|
|mwclient-0.8.7-py2.py3-none-any.whl (29.5 kB) Copy SHA256 hash SHA256||Wheel||py2.py3||Jan 14, 2018|
|mwclient-0.8.7.tar.gz (33.9 kB) Copy SHA256 hash SHA256||Source||None||Jan 14, 2018|