Git Product home page Git Product logo

python-wikibase's Introduction

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.

Installation

pip install python-wikibase

Usage

Simple example for adding a coordinate location claim to an existing Wikibase item:

from python_wikibase import PyWikibase

# Authenticate with Wikibase
py_wb = PyWikibase(config_path="config.json")

# Fetch item and "coordinate location" property
item = py_wb.Item().get(entity_id="item label")
prop = py_wb.Property().get(entity_id="coordinate location")

# Create new GeoLocation value
value = py_wb.GeoLocation().create(1.23, 4.56)

# Create GeoLocation claim
claim = item.claims.add(prop, value)

See the documentation for descriptions and examples of all commands.

Authentication

The PyWikibase class takes the same authentication and configuration parameters as the WikibaseApi class from the wikibase-api library (which is used internally). See its documentation for a guide on how to authenticate with Wikibase.

Development

Setup

See this guide on how to set up a development environment for this package.

If you'd like to test this package with a local instance of Wikibase, see this guide on how to set up a development instance with wikibase-docker.

TODO

  • Implement Sitelink class
  • Implement missing data types (see data_type.py)

Contributing

Suggestions and contributions are always welcome! Please first discuss changes via issue before submitting a pull request.

python-wikibase's People

Contributors

samuelmeuli avatar cbenz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.