🤖 A Python library that interfaces with the MediaWiki API. This is a mirror from gerrit.wikimedia.org. See https://www.mediawiki.org/wiki/Developer_access for contributing.
Clone or download
jenkins-bot Gerrit Code Review
jenkins-bot and Gerrit Code Review Merge "[test] Enable script_tests for patrol.py"
Latest commit a351efc Oct 20, 2018
Permalink
Failed to load latest commit information.
docs tox.ini: Use the default max_line_length Oct 5, 2018
pywikibot [L10N] Update families files Oct 19, 2018
scripts Merge "[test] Enable script_tests for patrol.py" Oct 20, 2018
tests Merge "[test] Enable script_tests for patrol.py" Oct 20, 2018
.appveyor.yml .appveyor.yml: Fix and cleanup the matrix Oct 3, 2018
.codeclimate.yml [test] fix codeclimate pattern Mar 3, 2018
.codecov.yml Add .coveragerc and codecov.yml May 25, 2016
.coveragerc Add .coveragerc and codecov.yml May 25, 2016
.gitignore git ignore cache folder (for windows users) too Oct 7, 2017
.gitmodules Fix url for .gitmodules Oct 14, 2017
.gitreview Add .gitreview file for git migration Jul 8, 2013
.svnprops update .svnprops Jun 23, 2015
.travis.yml Remove cryptography<2.3 from python<=2.7.6 requirements Sep 7, 2018
CODE_OF_CONDUCT.rst [doc] use reStructuredText instead of markdown Dec 20, 2017
CONTENT.rst Deprecate requests-requirements.txt May 2, 2018
CREDITS CREDITS: Add myself as contributor to the Pywikibot project Sep 22, 2018
ChangeLog Update ChangeLog for release 3.0.20170713 Sep 4, 2017
Dockerfile Install dev-requirements.txt into Docker image Dec 8, 2015
HISTORY.rst [doc] Update HISTORY.rst Oct 15, 2018
LICENSE [cleanup] Fix copyright years Jun 2, 2018
README-conversion.txt [doc] Update README-conversion.txt and explain debugging level Oct 15, 2018
README.rst [doc] Narrow or fix multiple links Jun 19, 2018
dev-requirements.txt Revert "Setup VCR for dry tests" Sep 2, 2018
ez_setup.py Fix diff_checker related errors in Python files of the root directory Sep 28, 2018
generate_family_file.py Fix output about API and MediaWiki version Oct 7, 2018
generate_user_files.py Fix diff_checker related errors in Python files of the root directory Sep 28, 2018
pwb.py tox.ini: Use the default max_line_length Oct 5, 2018
requests-requirements.txt Remove cryptography<2.3 from python<=2.7.6 requirements Sep 7, 2018
requirements.txt [bugfix] Require pydot>=1.2 for interwiki_graph Oct 1, 2018
setup.py tox.ini: Use the default max_line_length Oct 5, 2018
tox.ini [PEP8] Solve flake8 doctests Oct 15, 2018
user-config.py.sample [doc] remove duplicate spaces inside doc strings Nov 14, 2016
user-fixes.py.sample Import unicode_literals in user-fixes.py.sample May 2, 2017

README.rst

Travis Build Status AppVeyor Build Status Code coverage Maintainability Pywikibot release

Pywikibot

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 https://gerrit.wikimedia.org/r/pywikibot/core.git
cd core
git submodule update --init
python pwb.py script_name

Or to install using PyPI (excluding scripts)

pip install -U setuptools
pip install pywikibot

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')
page.save('Replacing "foo" with "bar"')  # Saves the page

For more documentation on pywikibot see our docs.

Required external programs

It may require the following programs to function properly:

  • 7za: To extract 7z files

Contributing

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