Skip to main content

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.

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-2.0.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mw_api_client-2.0.0-py2.py3-none-any.whl (13.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file mw-api-client-2.0.0.tar.gz.

File metadata

  • Download URL: mw-api-client-2.0.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mw-api-client-2.0.0.tar.gz
Algorithm Hash digest
SHA256 62b1537a8aeca06207627e8e588b4a3e3b182907997cdd0ef420a71be7d10ded
MD5 8604ab9caf376890afe1ad18d4c8bdb6
BLAKE2b-256 c6b671a396be0d7f62e6fd790d9fec0981700e7afd90caead253c4e81c86441a

See more details on using hashes here.

File details

Details for the file mw_api_client-2.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for mw_api_client-2.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3a07a871c73904567e6966008e82726f5505cc848994ea2fbcb4909ba7b54dd4
MD5 bb9924e9d21e1b3f61e0bab19fcc97a2
BLAKE2b-256 845c63718cab53f7c3b48c324ae18614b0e6453600baa4b4f8112c73d37641ce

See more details on using hashes here.

Supported by

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