specialbots package¶
Module containing special bots reusable by scripts.
-
class
pywikibot.specialbots.
BaseUnlinkBot
(**kwargs)[source]¶ Bases:
pywikibot.bot.ExistingPageBot
,pywikibot.bot.NoRedirectPageBot
,pywikibot.bot.AutomaticTWSummaryBot
A basic bot unlinking a given link from the current page.
Redirect all parameters and add namespace as an available option.
-
class
pywikibot.specialbots.
InteractiveUnlink
(bot)[source]¶ Bases:
pywikibot.bot.InteractiveReplace
An implementation which just allows unlinking.
Create default settings.
-
class
pywikibot.specialbots.
UploadRobot
(url: Union[list, str], urlEncoding='[deprecated name of url_encoding]', useFilename='[deprecated name of use_filename]', keepFilename='[deprecated name of keep_filename]', verifyDescription='[deprecated name of verify_description]', ignoreWarning='[deprecated name of ignore_warning]', targetSite='[deprecated name of target_site]', *, url_encoding=None, description: str = '', use_filename=None, keep_filename: bool = False, verify_description: bool = True, ignore_warning: Union[bool, list] = False, target_site=None, aborts: Optional[Union[bool, list]] = None, chunk_size: int = 0, asynchronous: bool = False, summary: Optional[str] = None, filename_prefix: Optional[str] = None, force_if_shared: bool = False, **kwargs)[source]¶ Bases:
pywikibot.bot.BaseBot
Upload bot.
Changed in version 6.2: asynchronous upload is used if asynchronous parameter is set.
New in version 6.4: force_if_shared parameter.
- Parameters
url – path to url or local file, or list of urls or paths to local files.
description (str) – Description of file for its page. If multiple files are uploading the same description is used for every file.
use_filename – Specify title of the file’s page. If multiple files are uploading it asks to change the name for second, third, etc. files, otherwise the last file will overwrite the other.
keep_filename – Set to True to keep original names of urls and files, otherwise it will ask to enter a name for each file.
summary – Summary of the upload
verify_description – Set to True to proofread the description.
ignore_warning – Set this to True to upload even if another file would be overwritten or another mistake would be risked. Set it to an array of warning codes to selectively ignore specific warnings.
target_site (object) – Set the site to upload to. If target site is not given it’s taken from user-config.py.
aborts – List of the warning types to abort upload on. Set to True to abort on any warning.
chunk_size – Upload the file in chunks (more overhead, but restartable) specified in bytes. If no value is specified the file will be uploaded as whole.
asynchronous – Make potentially large file operations asynchronous on the server side when possible.
filename_prefix – Specify prefix for the title of every file’s page.
force_if_shared – Upload the file even if it’s currently shared to the target site (e.g. when moving from Commons to another wiki)
- Keyword Arguments
always – Disables any input, requires that either ignore_warning or aborts are set to True and that the description is also set. It overwrites verify_description to False and keep_filename to True.
-
ignore_on_warn
(warn_code: str)[source]¶ Determine if the warning message should be ignored.
- Parameters
warn_code – The warning message