Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Python MediaWiki Bot Framework

Project description


The Pywikibot framework is a Python library that interfaces with the MediaWiki API version 1.14 or higher.

Also included are various general function scripts that can be adapted for different tasks.

For further information about the library excluding scripts see the full code documentation.

Quick start

git clone
cd core
git submodule update --init
python script_name

Or to install using PyPI (excluding scripts)

pip install pywikibot --pre

Our installation guide has more details for advanced usage.

Basic Usage

If you wish to write your own script it’s very easy to get started:

import pywikibot
site = pywikibot.Site('en', 'wikipedia')  # The site we want to run our bot on
page = pywikibot.Page(site, 'Wikipedia:Sandbox')
page.text = page.text.replace('foo', 'bar')'Replacing "foo" with "bar"')  # Saves the page

For more documentation on pywikibot see our docs.

The contents of the package

pywikibot Library routines, control files and global settings
pywikibot/comms Communication layer
pywikibot/compat Package to provide compatibility with compat scripts
pywikibot/data Module with several layers for data access to wiki
pywikibot/families wiki-specific information and settings
pywikibot/tools Miscellaneous helper functions (not wiki-dependent)
pywikibot/userinterfaces GUI and terminal interface

Required external programs

It may require the following programs to function properly:

  • 7za: To extract 7z files

Release history

Current release

  • Introduce userscripts directory
  • Generator settings inside (user-)
  • BaseUnlinkBot has become part of the framework in
  • Decommission of rcstream
  • Script files added to
  • Other documentation updates
  • Bugfixes and improvements
  • Localisation updates


  • Bugfixes and improvements
  • Localisation updates


  • Implement server side event client EventStreams
  • Add thanks log support
  • new script to create hyphenated redirects
  • new script to flag new articles
  • new WbUnknown data type for Wikibase
  • Deprecate APISite.newfiles()
  • new pagegenerators filter option -titleregexnot
  • Inverse of pagegenerators -namespace option
  • Bugfixes and improvements
  • Localisation updates
  • Remove script
  • Remove anarchopedia family out of the framework
  • CODE_OF_CONDUCT included


  • Replaced the word ‘async’ with ‘asynchronous’ due to python 3.7
  • Support for Python 2.6 but higher releases are strictly recommended
  • Bugfixes and improvements
  • Localisation updates


  • First major release from master branch
  • requests package is mandatory
  • Deprecate previous 2.0 branches


  • Last stable 2.0 branch


  • Remove dependency on pYsearch
  • Desupport Python 2.6 for Pywikibot 2.0 release branch


  • Bugfixes
  • Localisation updates
  • i18n: always follow master branch


  • Bugfixes and improvements
  • Localisation updates


  • New scripts and ported from old compat branch
  • now supports wikibase
  • RecentChanges stream (rcstream) support
  • Sphinx documentation at
  • Bugfixes and improvements
  • Localisation updates


  • Bugfixes and improvements


  • Bugfixes and improvements


  • First stable release branch


Our code is maintained on Wikimedia’s Gerrit installation, learn how to get started.

Build Status Pywikibot release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pywikibot-3.0.20171212.tar.gz (485.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page