API reference#
High-level request structure#
User code mainly interacts with pywikibot.Page objects, which represent
pages on a specific wiki. These objects get their properties by calling functions
on their associated pywikibot.Site object, which represents a specific
wiki.
The pywikibot.Site object then calls the MediaWiki API using the
functions provided by data.api. This layer then uses comms.http.request()
to do the actual HTTP request.
Table of contents#
pywikibot— Base Classes and FunctionsBotCategoryClaimCoordinateCurrentPageBotFilePageItemPageLexemeFormLexemePageLexemeSenseLinkMediaInfoPagePropertyPageSite()SiteLinkTimestampUserWbGeoShapeWbMonolingualTextWbQuantityWbTabularDataWbTimeWbUnknownWikidataBotasync_manager()async_request()calledModuleName()critical()debug()error()exception()handle_args()html2unicode()info()input()input_choice()input_yn()log()output()showDiff()show_help()sleep()stdout()stopme()translate()url2unicode()warning()
config— Pywikibot Config Filepage— MediaWiki PagesBaseLinkBasePageCategoryClaimFileInfoFilePageItemPageLexemeFormLexemePageLexemeSenseLinkMediaInfoPagePropertyPropertyPageRevisionSiteLinkUserWikibaseEntityWikibasePagehtml2unicode()url2unicode()page._collectionsWikibase Entity Structurespage._decorators— Page Decoratorspage._revision— Page Revisionpage._toolforgemodule
proofreadpage— ProofreadPage Extensionpagegenerators— Page Generators- GENERATOR OPTIONS
- FILTER OPTIONS
AllpagesPageGenerator()AncientPagesPageGenerator()CategorizedPageGenerator()CategoryFilterPageGenerator()DayPageGenerator()DeadendPagesPageGenerator()EdittimeFilterPageGenerator()FileLinksGenerator()GeneratorFactoryGoogleSearchPageGeneratorImagesPageGenerator()InterwikiPageGenerator()ItemClaimFilterPageGenerator()LanguageLinksPageGenerator()LinkedPageGenerator()LinksearchPageGenerator()LiveRCPageGenerator()LogeventsPageGenerator()LonelyPagesPageGenerator()LongPagesPageGenerator()MySQLPageGenerator()NamespaceFilterPageGenerator()NewimagesPageGenerator()NewpagesPageGenerator()PageTitleFilterPageGenerator()PagesFromPageidGenerator()PagesFromTitlesGenerator()PetScanPageGeneratorPrefixingPageGenerator()PreloadingGenerator()QualityFilterPageGenerator()RandomPageGenerator()RandomRedirectPageGenerator()RecentChangesPageGenerator()RedirectFilterPageGenerator()RegexBodyFilterPageGenerator()RegexFilterPageGenerator()SearchPageGenerator()ShortPagesPageGenerator()SubCategoriesPageGenerator()SubpageFilterGenerator()TextIOPageGenerator()UnCategorizedCategoryGenerator()UnCategorizedImageGenerator()UnCategorizedPageGenerator()UnCategorizedTemplateGenerator()UnconnectedPageGenerator()UnusedFilesGenerator()UnwatchedPagesPageGenerator()UserContributionsGenerator()UserEditFilterGenerator()WantedPagesPageGenerator()WikibaseItemFilterPageGenerator()WikibaseItemGenerator()WikibaseSearchItemPageGenerator()WikidataPageFromItemGenerator()WikidataSPARQLPageGenerator()WithoutInterwikiPageGenerator()XMLDumpPageGeneratorYearPageGenerator()page_with_property_generator()pagegenerators._factory— Pagegenerators Options Handlerpagegenerators._filters— Filter Funtionspagegenerators._generators— Generator Functions
site— MediaWiki sitesloginmodulelogentriesmodulefamily— MediaWiki familiesfamilies— Family Config Filesfamilies.commons_family— Commonsfamilies.foundation_family— Foundation Wikifamilies.i18n_family— Translate Wikifamilies.incubator_family— Incubatorfamilies.lingualibre_family— Lingua Librefamilies.mediawiki_family— MediaWikifamilies.meta_family— Metafamilies.osm_family— OpenStreetMapfamilies.outreach_family— Outreachfamilies.species_family— Speciesfamilies.vikidia_family— Vikidiafamilies.wikibooks_family— Wikibooksfamilies.wikidata_family— Wikidatafamilies.wikihow_family— Wikihowfamilies.wikimania_family— Wikimaniafamilies.wikimediachapter_family— Wikimedia Chapterfamilies.wikinews_family— Wikinewsfamilies.wikipedia_family— Wikipediafamilies.wikiquote_family— Wikiquotefamilies.wikisource_family— Wikisourcefamilies.wikisopore_family— Wikisporefamilies.wikitech_family— Wikitechfamilies.wikiversity_family— Wikiversityfamilies.wikivoyage_family— Wikivoyagefamilies.wiktionary_family— Wiktionaryfamilies.wowwiki_family— Fandom WOW
data— Data Exchangecomms— Communication layerexceptions— Exceptions and Warning ClassesAPIErrorAPIMWErrorAbuseFilterDisallowedErrorArgumentDeprecationWarningArticleExistsConflictErrorAutoblockUserErrorCaptchaErrorCascadeLockedPageErrorCircularRedirectErrorCoordinateGlobeUnknownErrorEditConflictErrorEntityTypeUnknownErrorErrorFamilyMaintenanceWarningFatalServerErrorHiddenKeyErrorInconsistentTitleErrorInterwikiRedirectPageErrorInvalidPageErrorInvalidTitleErrorIsNotRedirectPageErrorIsRedirectPageErrorLockedNoPageErrorLockedPageErrorMaxlagTimeoutErrorNoCreateErrorNoMoveTargetErrorNoPageErrorNoUsernameErrorNoWikibaseEntityErrorNotEmailableErrorNotImplementedWarningOtherPageSaveErrorPageCreatedConflictErrorPageDeletedConflictErrorPageInUseErrorPageLoadRelatedErrorPageRelatedErrorPageSaveRelatedErrorSectionErrorServer414ErrorServer504ErrorServerErrorSiteDefinitionErrorSpamblacklistErrorTimeoutErrorTitleblacklistErrorTranslationErrorUnknownExtensionErrorUnknownFamilyErrorUnknownSiteErrorUnsupportedPageErrorUploadErrorUserRightsErrorVersionParseErrorWikiBaseError
textlib— Changing WikitextMultiTemplateMatchBuilderTimeStripperadd_text()case_escape()categoryFormat()compileLinkR()does_text_contain_section()expandmarker()extract_sections()extract_templates_and_params()extract_templates_and_params_regex_simple()findmarker()getCategoryLinks()getLanguageLinks()glue_template_and_params()ignore_case()interwikiFormat()interwikiSort()isDisabled()reformat_ISBNs()removeCategoryLinks()removeCategoryLinksAndSeparator()removeDisabledParts()removeHTMLParts()removeLanguageLinks()removeLanguageLinksAndSeparator()replaceCategoryInPlace()replaceCategoryLinks()replaceExcept()replaceLanguageLinks()replace_links()to_latin_digits()to_local_digits()
cosmetic_changes— Cosmetic Changes of Wikitextbot— Classes for Building Botscritical()debug()error()exception()log()warning()output()stdout()LoggingFormatterset_interface()init_handlers()writelogheader()input()input_choice()input_yn()input_list_choice()uiOptionStandardOptionNestedOptionIntegerOptionContextOptionListOptionShowingListOptionMultipleChoiceListShowingMultipleChoiceListOutputProxyOptionHighlightContextOptionChoiceExceptionUnhandledAnswerChoiceStaticChoiceLinkChoiceAlwaysChoiceQuitKeyboardInterruptInteractiveReplacecalledModuleName()handle_args()show_help()suggest_help()writeToCommandLogFile()open_webbrowser()OptionHandlerBaseBotBotConfigParserBotSingleSiteBotMultipleSitesBotCurrentPageBotAutomaticTWSummaryBotExistingPageBotFollowRedirectPageBotCreatingPageBotRedirectPageBotNoRedirectPageBotWikidataBot
specialbots— Special Reusable Botsbot_choice— UI Options and Choicesuserinterfaces— User interfaces_interface_base— Abstract User Interfaceterminal_interfacemodule — Terminal User Interfaceterminal_interface_base— Base Terminal Interfaceterminal_interface_unix— Unix Terminal Interfaceterminal_interface_win32—- Windows Terminal Interfacebuffer_interface— Buffer Interfacegui— Graphical User Interfacetransliteration— Transliteration
logging— Logging Functionsdaemonize— Daemonize Current Process (Unix only)date— Date Classes and FunctionsMonthFormatMonthNamesaddFmt1()alwaysTrue()apply_month_delta()decSinglVal()dh()dh_centuryAD()dh_centuryBC()dh_constVal()dh_dayOfMnth()dh_decAD()dh_decBC()dh_millenniumAD()dh_millenniumBC()dh_mnthOfYear()dh_noConv()dh_number()dh_simpleYearAD()dh_singVal()dh_yearAD()dh_yearBC()encDec0()encDec1()escapePattern2()formatYear()format_date()getAutoFormat()get_month_delta()intToLocalDigitsStr()intToRomanNum()localDigitsStrToInt()makeMonthList()makeMonthNamedList()monthName()multi()romanNumToInt()slh()
time— Time Classes and Functionsdiff— Helpers for computing deltasecho— Echo Extension Classes and functionseditor— Text editor classfixes— standard fixes for replace.py scriptflow— Flow Entitiesi18n— i18n Supportplural— i18n Plural rulesinterwiki_graph— Graphviz Drawing for Interwikititletranslate— Interwiki Title Translatortools— Miscellaneous Helper FunctionsComparableMixinMediaWikiVersionModuleDeprecationWrapperSelfCallDictSelfCallMixinSelfCallStringVersionadd_decorated_full_name()add_full_name()cached()classpropertycompute_file_hash()deprecate_arg()deprecated()deprecated_args()file_mode_checker()first_lower()first_upper()get_wrapper_depth()has_module()is_ip_address()issue_deprecation_warning()manage_wrapping()merge_unique_dicts()normalize_username()open_archive()redirect_func()remove_last_args()strtobool()suppress_warningstools.chars— Character Based Helper Functionstools.collections— Container datatypestools.deprecate— Deprecating Decorators and Classestools.djvu— DJVU files wrappertools.formatter— Formatting Related Functions and Classestools.itertools— Iterators for Efficient Loopingtools.threading— Thread-based Classestools._logging— logging.Formatter Subclass
xmlreader— XML Readersite_detect— Classes for Detecting MediaWiki Sitesthrottle— Slow Down Wiki I/Oversion— Determine Pywikibot Versionbackports— Python Backports