Skip to content

Instantly share code, notes, and snippets.

@apple502j
Created March 11, 2018 10:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apple502j/af7fa17741e770aa8f747acea78c0a2f to your computer and use it in GitHub Desktop.
Save apple502j/af7fa17741e770aa8f747acea78c0a2f to your computer and use it in GitHub Desktop.
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