Manual:Pywikibot/basic.py

From Linux Web Expert

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

basic.py is a script of the Pywikibot framework. It is not a complete bot; rather, it is a template from which simple bots can be made. You can rename it to mybot.py, then edit it in whatever way you want.

Parameters

The following parameters are supported:

-always The bot won't ask for confirmation when putting a page.
-text: Use this text to be added; otherwise 'Test' is used.
-replace Don't add text but replace it.
-top Place additional text on top of the page.
-summary: Set the action summary message for the edit.

All page generator/filter options supported by pywikibot.pagegenerators are also supported, e.g., -recentpages: and -page:.

Use global -simulate option for test purposes. No changes are made to the live wiki if this option is supplied.

Example

$ python pwb.py basic -simulate -page:User:MyUserName
This tries to append "Text" to the page User:MyUserName. Since the -simulate option is given, the actual page on the live wiki won't be modified.