Skip to main content

A simple MediaWiki client.

Project description

A really simple MediaWiki API client.


  • read pages

  • edit pages

  • list pages in category

  • list page backlinks (“what links here”)

  • list page transclusions

Requires the requests library.

Example Usage

Get a page:

wiki = Wiki()

wiki.login("kenny2wiki", password)

sandbox ="User:Kenny2wiki/Sandbox")

Edit page:

# Get the page
contents =

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

# Submit
sandbox.edit(contents, summary)

List pages in category:

for page in wiki.category_members("Redirects"):
    print page.title

Remove all uses of a template:

target_pages = wiki.transclusions("Template:Stub")

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

# Main namespace only
target_pages = [p for p in target_pages if p.query_info()['ns'] == 0]

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

Made by Kenny2github, based on ~blob8108’s MWAPI client for the Scratch Wiki.

MIT Licensed.

Project details

Download files

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

Source Distribution

mw-api-client-0.0.0.tar.gz (3.7 kB view hashes)

Uploaded source

Built Distribution

mw_api_client-0.0.0-py2-none-any.whl (5.8 kB view hashes)

Uploaded py2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page