python-wikibase
python-wikibase
provides an object-oriented abstraction of the Wikibase API.
The library simplifies the authentication process and can be used to query and edit information on Wikidata or any other Wikibase instance.
Example
from python_wikibase import PyWikibase
py_wb = PyWikibase(config_path="config.json")
item = py_wb.Item().get(entity_id="item label")
prop = py_wb.Property().get(entity_id="coordinate location")
value = py_wb.GeoLocation().create(1.23, 4.56)
claim = item.claims.add(prop, value)
Installation
pip install python-wikibase
Authentication
The PyWikibase
class takes the same authentication and configuration parameters as the WikibaseApi
class from the wikibase-api
library. See its documentation for a guide on how to authenticate with Wikibase.
Usage
→ Documentation