Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Clean Your Sandbox (MW bot) need kenny2github/mw-api-client
# This code is in the public domain.
import mw_api_client as mw
from getpass import getpass
API_PATH="" # API URL like https://en.wikipedia.org/w/api.php
USERAGENT="Sandbox Cleaner with mw_api_client" # User-Agent
USERNAME="" # User name
SANDBOXPATH="" # Sandbox path
DEFAULT_SANDBOX="" # Default Sandbox contents
SUMMARY="Clean Sandbox (via cleansandbox.py)"
wiki=mw.Wiki(API_PATH,USERAGENT)
wiki.login(USERNAME,getpass("Password for {0} >".format(USERNAME)))
sandbox=wiki.page(SANDBOXPATH)
sandbox.edit(DEFAULT_SANDBOX,SUMMARY)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.