Skip to main content

A client for the BatchIngestion mediawiki API

Project description

BatchIngestion Python Client

This is a Python client library for the BatchIngestion MediaWiki extension, which provides an API to ingest many entities at once. This library allows you to easily ingest entities in bulk, either by parsing them from JSON or by creating them using Python objects.

Installation

You can install this library using pip:

pip install batch-ingestion-client-py==1.0.4

Usage

from batch_ingestion_client_py import (
    BatchIngestor,
    Entity,
    ValueInLanguage,
)

ingestor = BatchIngestor(
    base_url="https://your-wiki.com",
    username="your-username",
    password="your-password",
)

example1 = ingestor.ingest([
    Entity.parse({
        "type": "item",
        "labels": {
            "en": {
                "language": "en",
                "value": "Hello, world!",
            },
        },
    })
])

print(example1)

example2 = ingestor.ingest([
    Entity(
        type="item",
        labels={
            "en": ValueInLanguage(
                language="en",
                value="Hello, world!",
            ),
        },
    ),
])

print(example2)

Contributing

If you'd like to contribute to this library, please feel free to submit a pull request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

batch_ingestion_client_py-1.0.4.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page