Manual:Pywikibot/clean sandbox.py

clean_sandbox.py is a simple script that automatically reverts the page Project:Sandbox to a "clean" state, replacing the text on the page with a predefined message. This message is found within the file  within the   folder on your computer.

Usage
Using clean_sandbox.py is exceedingly easy. Just type   If you wish, you can add a couple of arguments to the base instruction:

-hours:#      Use this parameter if to make the script repeat itself after # hours. Hours can be defined as a decimal. 0.01                  hours are 36 seconds; 0.1 are 6 minutes.

-delay:#      Use this parameter for a wait time after the last edit was made. If no parameter is given it takes it from hours and limits it between 5 and 15 minutes. The minimum delay time is 5 minutes.

-text         The text that substitutes in the sandbox, you can use this when you haven't configured clean_candbox for your wiki.

-summary      Summary of the edit made by bot.

There isn't much point to running this script manually. Since it only works on one page, you could accomplish the same task just as easily by going into the sandbox page history and undoing to the last point where the page was clean. However, if you keep one python window open on your computer at all times, and you commit it to running this script once every 12 hours with a certain amount of delay, it's then possible to automatically clean your sandbox, regularly and in a way that waits until it appears like no one is using the sandbox. A reasonable command would therefore be:

Config parser
clean sandbox.py is a config parser bot which supports reading options from a  configuration file. That file must contain a section header  and followed by   or   entries of these option given above. Inline comments may be given by a preceeding ';' whereas comments may be start with '#' or ';'. For example:

Options given with the command line will overwrite the config file settings and the config file settings relaces the default values.

Replacement text
By default,  comes with a number of predefined messages in various languages. If you wish to change the message, use the  option or use the config parser settings explained above. Otherwise, make note of the template that is being called with the scrupt and make sure that your wiki has a template with exactly that same name. That template should contain a message about the rules or instructions your wiki has for the use of the sandbox page.