Skip to content

About

A Python module to manipulate data on a Wikibase instance (like Wikidata) through the MediaWiki Wikibase API and the Wikibase SPARQL endpoint.

Topics

Resources

Contributing

Stars

93 stars

Watchers

2 watching

Forks

Repository files navigation

Wikibase Integrator

PyPi Python pytest Coverage Python Code Quality and Lint CodeQL Pyversions Documentation

WikibaseIntegrator is a Python library to read and write the data of a Wikibase instance, like Wikidata: items, properties, lexemes and MediaInfo entities, with their labels, claims, qualifiers and references, through the MediaWiki API and the SPARQL endpoint. Its "fast run" mode compares your data with the SPARQL endpoint and only writes what actually changed.

Installation

python -m pip install wikibaseintegrator

Python 3.11.5 or newer is required.

Quick example

from wikibaseintegrator import WikibaseIntegrator
from wikibaseintegrator.wbi_config import config

# Wikimedia asks every tool to identify itself: https://foundation.wikimedia.org/wiki/Policy:User-Agent_policy
config['USER_AGENT'] = 'MyTool/1.0 (https://www.wikidata.org/wiki/User:MyUsername)'

wbi = WikibaseIntegrator()
item = wbi.item.get('Q582')
print(item.labels.get('en'))  # Villeurbanne

To log in and write, see Login and Entities.

Documentation

The documentation is on GitHub Pages, for the latest release and for the development version:

Upgrading from an older version (v0.13, v0.12, v0.11)? See the breaking changes.

Contributing

See Contributing to set up the development environment and run the tests.

WikibaseIntegrator is a fork of WikidataIntegrator, see About. To port a WikidataIntegrator script, see the migration guide.

About

A Python module to manipulate data on a Wikibase instance (like Wikidata) through the MediaWiki Wikibase API and the Wikibase SPARQL endpoint.

Topics

Resources

Contributing

Stars

93 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages