Recipes#

For more recipes, see the Pywikibot Cookbook.

How to modify a page#

>>> page = pywikibot.Page(pywikibot.Site(), 'Sample page')
>>> new_content = page.text.replace('this', 'that')
>>> page.put(new_content, summary='Bot: Test edit')

See Using pywikibot as library for more advanced samples.