Pywikipediabot/protect.py
From Meta, a Wikimedia project coordination wiki
Subversion repository of Wikimedia has this file:
# -*- coding: utf-8 -*- import wikipedia def protect(pageName, reason): site = wikipedia.getSite() page = wikipedia.Page(site, pageName) page.protect(reason, False) if __name__ == "__main__": try: protect('Test', "Bot: Test") except: wikipedia.stopme() finally: wikipedia.stopme()
See wikipedia.py for more details of the protect function.
Docs in code:
Syntax: python protect.py OPTION... Command line options: -page: Protect specified page -cat: Protect all pages in the given category. -nosubcats: Don't protect pages in the subcategories. -links: Protect all pages linked from a given page. -file: Protect all pages listed in a text file. -ref: Protect all pages referring from a given page. -images: Protect all images used on a given page. -always: Don't prompt to protect pages, just do it. -summary: Supply a custom edit summary. -unprotect: Actually unprotect pages instead of protecting -edit:PROTECTION_LEVEL Set edit protection level to PROTECTION_LEVEL -move:PROTECTION_LEVEL Set move protection level to PROTECTION_LEVEL ## Without support ## ## -create:PROTECTION_LEVEL Set move protection level to PROTECTION_LEVEL ## Values for PROTECTION_LEVEL are: sysop, autoconfirmed, none. If an operation parameter (edit, move or create) is not specified, default protection level is 'sysop' (or 'none' if -unprotect).