mwclient
MediaWiki API client
What it is and what it does
mwclient is a lightweight Python wrapper around the MediaWiki API that lets you interact with MediaWiki instances (Wikipedia, Wikimedia projects, and self-hosted wikis) from Python code. It abstracts the HTTP API details into a simple object model where you work with Site, Page, and User objects rather than raw API calls. The library handles authentication via requests-oauthlib and supports most MediaWiki API operations, raising MediaWikiVersionError when a function isn't available on the target wiki version.
The package is designed for automation tasks like bulk editing, content analysis, bot development, and metadata retrieval. It works with Python 3.5 and above and MediaWiki 1.16 and above, making it compatible with a wide range of wiki deployments. The project has been actively maintained since 2011 and currently supports Python 3.5 through 3.12.
Use it for:
- Write bots to automate bulk edits or content updates on Wikipedia or other MediaWiki sites
- Retrieve page content, metadata, and revision history programmatically for analysis or archival
- Automate user account operations and permission management on self-hosted MediaWiki instances
- Build tools to monitor wiki activity or synchronize content between wikis
- Perform batch uploads or category management across multiple pages
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
mwclient is a Python client library for the MediaWiki API that provides programmatic access to MediaWiki instances like Wikipedia, enabling read and write operations on wiki content.
Yes. mwclient is actively maintained, has low install friction, carries no known vulnerabilities, and is the standard choice for Python-based MediaWiki automation. Install it if you need to interact with Wikipedia or any MediaWiki instance from Python code.
Install
mwclient on PyPI
pip
pip install mwclientuv
uv add mwclientpoetry
poetry add mwclientInstalling mwclient
Before you install
Low install friction with a single runtime dependency (requests-oauthlib). The project is actively maintained with a recent commit history and has been stable since its early releases.
License in practice
MIT license permits unrestricted use, modification, and distribution for commercial and private purposes with minimal obligations.
Quickstart
pip install mwclient
import mwclient
site = mwclient.Site('en.wikipedia.org')
page = site.pages['Example']
text = page.text()
Verify before relying
- Whether OAuth authentication is required or optional for typical read operations
- Current compatibility with MediaWiki versions newer than those documented in the description
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — requests-oauthlib |
| Maintenance | actively maintained — 732 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 168,179/month — #10,452 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mwclient-0.11.0-py3-none-any.whl
Keywords: mediawiki, wikipedia
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
pywikibotPywikibot is a Python framework that interfaces…
permissive · top 15,000 on PyPI
wikipediaProvides simple Python access to Wikipedia…
permissive · top 5,000 on PyPI
mwcliProvides helper functions and classes for…
permissive · top 15,000 on PyPI
mwtypesProvides standardized Python classes for…
permissive · top 15,000 on PyPI
mwxmlEfficiently parse and stream-process MediaWiki…
permissive · top 15,000 on PyPI
mwparserfromhellParses MediaWiki wikicode into a queryable…
permissive · top 5,000 on PyPI
Wikipedia-APIWikipedia-API is a Python wrapper for…
permissive · top 5,000 on PyPI
wikitextparserParses and manipulates MediaWiki wikitext…
copyleft · top 15,000 on PyPI
wikipedia-mcpExposes Wikipedia search, article retrieval,…
permissive · top 15,000 on PyPI
graphqlclientA lightweight GraphQL client that sends queries…
permissive · top 15,000 on PyPI