Need help with pywikibot?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

405 Stars 162 Forks MIT License 14.6K Commits 0 Opened issues


🤖 A Python library that interfaces with the MediaWiki API. This is a mirror from Do not submit any patches here. See for contributing.

Services available


Need anything else?

Contributors list

.. image:: :alt: Travis Build Status :target: .. image:: :alt: AppVeyor Build Status :target: .. image:: :alt: Code coverage :target: .. image:: :alt: Maintainability :target: .. image:: :alt: Python :target: .. image:: :alt: Pywikibot release :target: .. image:: :alt: Total downloads :target: .. image:: :alt: Monthly downloads :target: .. image:: :alt: Weekly downloads :target:


The Pywikibot framework is a Python library that interfaces with the

MediaWiki API 
_ version 1.23 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 -U setuptools
pip install pywikibot


_ 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

Wikibase Usage

Wikibase is a flexible knowledge base software that drives Wikidata. A sample pywikibot script for getting data from Wikibase:


import pywikibot
site = pywikibot.Site('wikipedia:en')
repo = site.data_repository()  # the wikibase repository for given site
page = repo.page_from_repository('Q91')  # create a local page for the given item
item = pywikibot.ItemPage(repo, 'Q91')  # a repository item
data = item.get()  # get all item data from repository for this item

For more documentation on pywikibot see our


.. include:: pywikibot/DIRECTORIES.rst

Required external programs

It may require the following programs to function properly:

  • 7za
    : To extract 7z files


.. include:: ROADMAP.rst

Release history



Our code is maintained on Wikimedia's

Gerrit installation 
, `learn <>`_ how to get started.

.. include:: CODEOFCONDUCT.rst

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.