skillfed

mwclient

MediaWiki API client

mwclient v0.11.0 168.2K downloads/30d#10,452 on PyPI347
Permissive license MIT Active released

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 mwclient

uv

uv add mwclient

poetry

poetry add mwclient

Installing 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

Programming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

mediawiki api clientwikipedia api pythonwiki content automationmediawiki bot libraryprogrammatic wiki accesswikipedia editing librarymediawiki page editing
wiki-automationapi-clientmediawiki

More WWW/HTTP packages