Skip to main content

Transkribus API Client

Tests

Python bindings for the new Transkribus Developer Platform, the old Transkribus Metagrapho/Processing API and the Transkribus Legacy API. This project unites my previous separate projects for the Metagrapho/Processing APIt and Legacy API.

Usage

import lxml
import transkribus

from time import sleep

with transkribus.open(USERNAME, PASSWORD) as api:
    process_ids = [
        api.metagrapho.process(IMAGE_PATH, line_detection=49272, htr_id=51170)["processId"],
        api.metagrapho.process(IMAGE_URL, line_detection=49272, htr_id=51170)["processId"],
    ]

    done = set()
    while True:
        for process_id in process_ids:
            if process_id in done:
                continue
            match api.metagrapho.status(process_id)["status"].lower():
                case "finished":
                    with open(f"{process_id}-page.xml", "wb") as f:
                        lxml.etree.tostring(api.metagrapho.page(process_id), pretty_print=True)
                    with open(f"{process_id}-alto.xml", "wb") as f:
                        lxml.etree.tostring(api.metagrapho.alto(process_id), pretty_print=True)
                    done.add(process_id)
                case "failed":
                    print(f"{process_id} FAILED")
                    done.add(process_id)
        if len(done) == len(process_ids):
            break
        sleep(10)

Metadata

Release files for transkribus-api 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for transkribus-api 0.1.1
File Interpreter ABI Platform
transkribus_api-0.1.1-py3-none-any.whl Python 3 none any Details

Release files / transkribus_api-0.1.1-py3-none-any.whl

Download URL transkribus_api-0.1.1-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5d87f84665a5fab12fec00f2ad5cfbb9b6142896c7782d3d97bc5ab39181dbd
BLAKE2b-256 checksum
How to use checksums
0ce060b592acdd26d287919eefacf0dfa78fd7806996b89012412642a0d624c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page