Skip to main content

Wrapper for mwclient with improvements for 3rd party wikis

Project description

py-3rdparty-mediawiki (Wikipush Toolkit)

Join the discussion pypi Github Actions Build GitHub issues GitHub closed issues PyPI Status API Docs License BITPlan

Python wrapper for mwclient with improvements for 3rd party wikis. Also known as the Wikipush Toolkit — a set of tools for automating MediaWiki page content handling using Python and a command line, presented at SMWCon Fall 2020. Works with any MediaWiki wiki: SMW wikis are queried natively; non-SMW wikis are supported by faking SMW-style queries for categories, enabling page pushing from wikis without Semantic MediaWiki installed.

Installation

pip install py-3rdparty-mediawiki

For MCP server support (for AI assistants):

pip install py-3rdparty-mediawiki[mcp]

Examples

wikipush

Copy pages between wikis:

wikipush -s smw -t test2 -q "[[Category:City]]|limit=5"
copying 4 pages from smw to test2
copying Demo:Tokyo ...✅
copying image File:SMW-Info-button.png ...✅
copying image File:Tokyo-Tsukishima-0011.jpg ...✅
copying Vienna ...✅
copying Warsaw ...✅
copying image File:6140285934 02e81b845f z.jpg ...✅
copying Demo:Würzburg ...✅

wikiupload

Upload files to a wiki:

wikiupload -t test --files car.png
uploading 1 files to test
1/1 ( 100%): uploading car.png ...✅

wikinuke

The default behavior is a dry run, listing whether the pages exist:

wikinuke -t test -p deleteMe1 deleteMe2 deleteMe3
deleting 3 pages in test (dry run)
1/3 (  33%): deleting deleteMe1 ...👍
2/3 (  67%): deleting deleteMe2 ...👍
3/3 ( 100%): deleting deleteMe3 ...👍

Use -f to force actual deletion:

wikinuke -t test -p deleteMe1 deleteMe2 deleteMe3 -f
deleting 3 pages in test (forced)
1/3 (  33%): deleting deleteMe1 ...✅
2/3 (  67%): deleting deleteMe2 ...✅
3/3 ( 100%): deleting deleteMe3 ...✅

wikiedit

Search and replace content in wiki pages:

wikiedit -t test -q "[[isA::CFP]]" --search "CALL FOR PAPER" --replace "CFP"
editing 1 pages in test (dry run)
1/1 ( 100%): editing CALL FOR PAPER Journal: Advances in Multimedia ... 👍

wikiuser

Configure wiki credentials interactively:

wikiuser
email: john@doe.com
scriptPath: /w
user: jd
url: http://www.semantic-mediawiki.org
version: Mediawiki 1.33
wikiId: smw
password: ****
shall i store jd smw? yes/no y/n

Links

Documentation

Wiki

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

py_3rdparty_mediawiki-0.19.6.tar.gz (85.4 kB view details)

Uploaded Source

Built Distribution

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

py_3rdparty_mediawiki-0.19.6-py3-none-any.whl (59.6 kB view details)

Uploaded Python 3

File details

Details for the file py_3rdparty_mediawiki-0.19.6.tar.gz.

File metadata

  • Download URL: py_3rdparty_mediawiki-0.19.6.tar.gz
  • Upload date:
  • Size: 85.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for py_3rdparty_mediawiki-0.19.6.tar.gz
Algorithm Hash digest
SHA256 4a9b0bfe1571ce20e846a5b78ad2acef50a69e7c24bf74435d0953c693df8c81
MD5 eadd12d054abec57fe31510e6a7ae198
BLAKE2b-256 d93657dc5cafec927a02a9286271b5b575defd47d697ace5dc5215f030de7310

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_3rdparty_mediawiki-0.19.6.tar.gz:

Publisher: upload-to-pypi.yml on WolfgangFahl/py-3rdparty-mediawiki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_3rdparty_mediawiki-0.19.6-py3-none-any.whl.

File metadata

File hashes

Hashes for py_3rdparty_mediawiki-0.19.6-py3-none-any.whl
Algorithm Hash digest
SHA256 6fb26785c656569667e10e53a0a0249e74174b04b3f0eee27d65cea489ca90ae
MD5 b980cbd66095225e9f03535ea0c71ee9
BLAKE2b-256 ad0e71e7ef3b08d81a66af27275b56bc10a6a42929ffed4d710a8cf278e60d1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_3rdparty_mediawiki-0.19.6-py3-none-any.whl:

Publisher: upload-to-pypi.yml on WolfgangFahl/py-3rdparty-mediawiki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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