Skip to main content

Tika REST Client

PyPi version

Python client for Apache Tika REST endpoints.

Overview

tika_rest_client provides a small, typed interface for common Apache Tika operations:

  • server health/version checks,
  • language identification,
  • text extraction (plain text or paginated),
  • metadata extraction.

It wraps HTTP/network failures with library-specific exceptions and returns structured response models.

Installation

pip install tika-rest-client

Requirements

  • Python 3.12+
  • A running Apache Tika server (for example on http://localhost:8080)

Quick Start

import io
from tika_rest_client import TikaRestClient

# IMPORTANT:
# In the current implementation, `host` is used as the full base URL.
# Example: "http://localhost:8080"
client = TikaRestClient(host="http://localhost:8080")

# Health check
print(client.check_connection())  # True / False

# Version
version = client.check_version()
print(version.response)  # e.g. "3.4.4"

# Language detection
lang = client.identify_language("Hello world")
print(lang.response)  # "en"

# Metadata extraction
metadata = client.extract_file_metadata(io.BytesIO(b"example content"))
print(metadata.metadata.general.content_type)

Main API

check_connection()

Returns True if the Tika server responds with HTTP 200 on the version endpoint, otherwise False.

check_version()

Returns a PlainTextResponse containing the server version. Raises TikaRestClientNetworkException on HTTP errors.

identify_language(input_to_test)

Accepts one of:

  • str

Returns PlainTextResponse. Raises:

  • InputFormatNotAvailableForThisEndpoint for unsupported input types,
  • LanguageIdentificationError when a language detection request fails.

extract_file_content(file_content, paginate, boilerpipe, ocr)

Extracts textual content from binary file data.

  • If paginate=False: returns PlainTextResponse.
  • If paginate=True: returns DocumentDividedInMatrixResponse.

Parameters:

  • file_content: file bytes wrapped in io.BytesIO
  • paginate: enable page-oriented output model
  • boilerpipe: use boilerpipe endpoint variant
  • ocr: enable OCR header for Tika

extract_file_metadata(content)

Extracts metadata and returns TikaMetadataResponse.

Response Models

Depending on the method, the client returns:

  • PlainTextResponse
  • DocumentDividedInMatrixResponse
  • TikaMetadataResponse

Each response includes client_info plus method-specific payload.

Error Handling

Library-specific exceptions include:

  • InputFormatNotAvailableForThisEndpoint
  • LanguageIdentificationError
  • TikaRestClientNetworkException

Example:

from tika_rest_client.exception import TikaRestClientNetworkException

try:
    print(client.check_version().response)
except TikaRestClientNetworkException:
    print("Unable to reach Tika server.")

Contributing

Contributions are welcome.

When opening a pull request:

  1. Keep style consistent with the project.
  2. Add or update tests when behavior changes.
  3. Document public API changes.

License

This project is licensed under the Creative Commons CC-BY-SA

licensebuttons by-nc-sa

Metadata

Release files for tika-rest-client 1.0.3

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

Source distribution (sdist)

Source distribution for tika-rest-client 1.0.3
File Size Uploaded Provenance
tika_rest_client-1.0.3.tar.gz 16.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for tika-rest-client 1.0.3
File Interpreter ABI Platform
tika_rest_client-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 37.1 kB

Release files / tika_rest_client-1.0.3.tar.gz

Download URL tika_rest_client-1.0.3.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8275c67749c6c1fea90b4dffb23b6385aeebba335d842ff66dec5c791e908e10
BLAKE2b-256 checksum
How to use checksums
8ea188481bdd681306c114f074b9b7371bc6c88f4380e59f5a0a993a5a4a93b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release files / tika_rest_client-1.0.3-py3-none-any.whl

Download URL tika_rest_client-1.0.3-py3-none-any.whl
Size 20.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f1ad465db077a4bd8209b30134e47ae390cbdaa8c658584731c8d87e00b8b5b
BLAKE2b-256 checksum
How to use checksums
8558049d04349fde55a0f7e53ddd21e439af1f4965a36abed7e0b9a9b93bda4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Security for tika-rest-client 1.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tika_rest_client-1.0.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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