Tika REST Client
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:
strbytes- buffered file-like object (
io.BytesIO,BinaryIO)
Returns PlainTextResponse.
Raises:
InputFormatNotAvailableForThisEndpointfor unsupported input types,LanguageIdentificationErrorwhen a language detection request fails.
extract_file_content(file_content, paginate, boilerplate, ocr)
Extracts textual content from binary file data.
- If
paginate=False: returnsPlainTextResponse. - If
paginate=True: returnsDocumentDividedInMatrixResponse.
Parameters:
file_content: file bytes wrapped inio.BytesIOpaginate: enable page-oriented output modelboilerplate: use boilerplate endpoint variantocr: enable OCR header for Tika
extract_file_metadata(content)
Extracts metadata and returns TikaMetadataResponse.
Response Models
Depending on the method, the client returns:
PlainTextResponseDocumentDividedInMatrixResponseTikaMetadataResponse
Each response includes client_info plus method-specific payload.
Error Handling
Library-specific exceptions include:
InputFormatNotAvailableForThisEndpointLanguageIdentificationErrorTikaRestClientNetworkException
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:
- Keep style consistent with the project.
- Add or update tests when behavior changes.
- Document public API changes.
License
This project is licensed under the Creative Commons CC-BY-SA
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tika_rest_client-1.0.2.tar.gz.
File metadata
- Download URL: tika_rest_client-1.0.2.tar.gz
- Upload date:
- Size: 16.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f37a6f825a947bb248496ce922c1833f24b74bc89839c3256c6ef46bbaa14c8
|
|
| MD5 |
836385b08a577fe3c0b203c3dadfdce8
|
|
| BLAKE2b-256 |
3176c939f85215e86581dd562c5ebfc67458b03213357892aafb03f099e7e930
|
Provenance
The following attestation bundles were made for tika_rest_client-1.0.2.tar.gz:
Publisher:
publish-to-test-pypi.yml on CyberCRI/tika-rest-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tika_rest_client-1.0.2.tar.gz -
Subject digest:
2f37a6f825a947bb248496ce922c1833f24b74bc89839c3256c6ef46bbaa14c8 - Sigstore transparency entry: 2288816846
- Sigstore integration time:
-
Permalink:
CyberCRI/tika-rest-client@8a79e785ed702ec80cd1d3e0bd1df0e51a262d11 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/CyberCRI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@8a79e785ed702ec80cd1d3e0bd1df0e51a262d11 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tika_rest_client-1.0.2-py3-none-any.whl.
File metadata
- Download URL: tika_rest_client-1.0.2-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c157134ecdff9b93f0950718fc989f35528eb3020c93f3af226d60c27dbf0fc
|
|
| MD5 |
23fd88c55d4a3d8b541a25733776fd07
|
|
| BLAKE2b-256 |
be02a39d31627990fbe7d2b2ee3cab03bbb42d9def60dda8d16addd3e56048d2
|
Provenance
The following attestation bundles were made for tika_rest_client-1.0.2-py3-none-any.whl:
Publisher:
publish-to-test-pypi.yml on CyberCRI/tika-rest-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tika_rest_client-1.0.2-py3-none-any.whl -
Subject digest:
2c157134ecdff9b93f0950718fc989f35528eb3020c93f3af226d60c27dbf0fc - Sigstore transparency entry: 2288817023
- Sigstore integration time:
-
Permalink:
CyberCRI/tika-rest-client@8a79e785ed702ec80cd1d3e0bd1df0e51a262d11 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/CyberCRI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@8a79e785ed702ec80cd1d3e0bd1df0e51a262d11 -
Trigger Event:
push
-
Statement type: