Manual:Pywikibot/protect.py

import wikipedia

site = wikipedia.getSite page = wikipedia.Page(site, pageName)

page.protect( reason = "This is a test...", prompt = False )

see wikipedia.py for more details of the protect function.