🤖 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 "Add .vscode in .gitignore"
Latest commit 69d0032 Nov 13, 2018
Permalink
Failed to load latest commit information.
docs tox.ini: Use the default max_line_length Oct 5, 2018
pywikibot [FIX] Prevent touch from re-creating pages Nov 9, 2018
scripts [IMPR] use issue_deprecation_warning for deprecated -autonomous option Nov 12, 2018
tests Merge "[IMPR] Strip disambiguation parens from articles" Nov 5, 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 Add .vscode in .gitignore Nov 12, 2018
.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 DIST=trusty environment variable from xenial job Nov 3, 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 Nov 12, 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] Add Python version shield to README.rst Oct 16, 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 [Security] use requests version 2.20.0 or later Oct 31, 2018
requirements.txt [Security] use requests version 2.20.0 or later Oct 31, 2018
setup.py [Security] use requests version 2.20.0 or later Oct 31, 2018
tox.ini Removed unused vars/parameters from daemonize.py and data/api.py Oct 25, 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 Python 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.