Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Wikipedia and MediaWiki API wrapper for Python

Project Description

mediawiki is a python wrapper and parser for the MediaWiki API. The goal is to allow users to quickly and efficiently pull data from the MediaWiki site of their choice instead of worrying about dealing directly with the API. As such, it does not force the use of a particular MediaWiki site. It defaults to Wikipedia but other MediaWiki sites can also be used.

MediaWiki wraps the MediaWiki API so you can focus on leveraging your favorite MediaWiki site’s data, not getting it. Please check out the code on github!

Note: this library was designed for ease of use and simplicity, not for advanced use. If you plan on doing serious scraping or automated requests, please use Pywikipediabot (or one of the other more advanced Python MediaWiki API wrappers), which has a larger API, advanced rate limiting, and other features so we may be considerate of the MediaWiki infrastructure.


Pip Installation:

$ pip install pymediawiki

To install from source:

To install mediawiki, simply clone the repository on GitHub, then run from the folder:

$ python install

mediawiki supports python versions 2.7 and 3.3 - 3.6


Documentation of the latest release is hosted on

To build the documentation yourself run:

$ pip install sphinx
$ cd docs/
$ make html

Automated Tests

To run automated tests, one must simply run the following command from the downloaded folder:

$ python test


Import mediawiki and run a standard search against Wikipedia:

>>> from mediawiki import MediaWiki
>>> wikipedia = MediaWiki()

Run more advanced searches:

>>> wikipedia.opensearch('washington')
>>> wikipedia.geosearch(title='washington, d.c.')
>>> wikipedia.geosearch(latitude='0.0', longitude='0.0')
>>> wikipedia.prefixsearch('arm')
>>> wikipedia.random(pages=10)

Pull a MediaWiki page and some of the page properties:

>>> p ='Chess')
>>> p.title
>>> p.summary
>>> p.categories
>>> p.images
>>> p.links

See the Documentation for more examples!


Please see the changelog for a list of all changes.


MIT licensed. See the LICENSE file for full details.

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(21.9 kB) Copy SHA256 Hash SHA256
py2.py3 Wheel Nov 21, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting