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

A simple MediaWiki client.

Project Description

A really simple MediaWiki API client.

Can use most MediaWiki API modules.

Requires the requests library.

http://www.mediawiki.org/

Example Usage

import mw_api_client as mw

Get a page:

wp = mw.Wiki("https://en.wikipedia.org/w/api.php", "MyCoolBot/0.0.0")

wp.login("kenny2wiki", password)

sandbox = wp.page("User:Kenny2wiki/sandbox")

Edit page:

# Get the page
contents = sandbox.read()

# Change
contents += "\n This is a test!"
summary = "Made a test edit"

# Submit
sandbox.edit(contents, summary)

List pages in category:

for page in wp.category("Redirects").categorymembers():
    print page.title

Remove all uses of a template:

stub = wp.template("Stub")

# Pages that transclude stub, main namespace only
target_pages = list(stub.transclusions(namespace=0))

# Sort by title because it's prettier that way
target_pages.sort(key=lambda p: p.title)

for page in target_pages:
    page.replace("{{stub}}", "")

Patrol all recent changes in the Help namespace:

rcs = wp.recentchanges(namespace=12)

for rc in rcs:
    rc.patrol()

Made by Kenny2github, based off of ~blob8108’s Scratch Wiki API client.

MIT Licensed.

Release History

This version
History Node

2.1.0

History Node

2.0.0

History Node

0.0.1

History Node

0.0.0

Download Files

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
mw_api_client-2.1.0-py2.py3-none-any.whl
(17.3 kB) Copy SHA256 Hash SHA256
Wheel py2.py3 Jan 18, 2018
mw-api-client-2.1.0.tar.gz
(16.0 kB) Copy SHA256 Hash SHA256
Source None Jan 18, 2018

Supported By

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 Google Google Cloud Servers DreamHost DreamHost Log Hosting