Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Wikipedia API on Python

Project description


PyPI version Version Build Status GitHub Issues License [Docs

MediaWikiAPI is a Python library that makes it easy to access and parse data from Wikipedia.

Search Wikipedia, get article summaries, get data like links and images from a page, and more. Wikipedia wraps the MediaWiki API <>__ so you can focus on using Wikipedia data, not getting it.

>>> from mediawikiapi import MediaWikiAPI
>>> mediawikiapi = MediaWikiAPI()
>>> print mediawikiapi.summary("Wikipedia")
# Wikipedia (/ˌwɪkɨˈpiːdiə/ or /ˌwɪkiˈpiːdiə/ WIK-i-PEE-dee-ə) is a collaboratively edited, multilingual, free Internet encyclopedia supported by the non-profit Wikimedia Foundation...

# [u'Barak (given name)', u'Barack Obama', u'Barack (brandy)', u'Presidency of Barack Obama', u'Family of Barack Obama', u'First inauguration of Barack Obama', u'Barack Obama presidential campaign, 2008', u'Barack Obama, Sr.', u'Barack Obama citizenship conspiracy theories', u'Presidential transition of Barack Obama']

>>> ny ="New York (state)")
>>> ny.title
# u'New York (state)'
>>> ny.url
# u''
>>> ny.content
# u'New York is a state in the northeastern United States. New York was one of the original thir'...
>>> ny.links[0]
# u'1790 United States Census'

>>> mediawikiapi.config.language = "fr"
>>> mediawikiapi.summary("Facebook", sentences=1)
# Facebook est un service de réseautage social en ligne sur Internet permettant d'y publier des informations (photographies, liens, textes, etc.) en contrôlant leur visibilité par différentes catégories de personnes.


To install MediaWikiAPI, simply run:

pip install mediawikiapi

MediaWikiAPI is compatible with Python 3 and Python 2.7.


Changelog could be find in the documentation.


The documentation is available here

To run tests, clone the repository on GitHub <>__, then run:

pip install -r requirements.txt
bash runtests  # will run tests for python and python3
python -m unittest discover tests/ '*'  # manual style

in the root project directory.

To build the documentation yourself, after installing requirements.txt, run:

pip install sphinx
cd docs/
make html


MIT licensed. See the LICENSE file <>__ for full details.


  • @goldsmith for making such a fantastic library to fork

Project details

Download files

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

Files for mediawikiapi, version
Filename, size File type Python version Upload date Hashes
Filename, size mediawikiapi- (14.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page