tika-python is a client for the Apache Tika server, a powerful toolkit for document parsing and metadata extraction from over a thousand different file types. It provides a simple API to interact with a running Tika server, allowing Python applications to leverage Tika's capabilities. The current version is 3.1.0. Releases tend to follow major Apache Tika server releases, with occasional bugfix updates.
pip install tikaVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to parse a local file using the `tika-python` client. It requires an Apache Tika server to be running and accessible. The client attempts to start the server automatically, but explicit management is often required for production use.
Ensure Java is installed and `JAVA_HOME` environment variable is set. For production, consider starting the Tika server manually (e.g., `java -jar tika-server.jar`) and configuring `tika-python` to connect to it, rather than relying on auto-start.
For large-scale processing, implement asynchronous parsing, use a task queue (e.g., Celery), or configure the Tika server with sufficient resources and appropriate timeouts.
Review code that passes custom headers to `from_file` or `from_buffer` and test thoroughly after upgrading to 3.1.0 to ensure the intended behavior is preserved.
Ideally, match your `tika-python` client version with the major version of the Tika server you are connecting to. Always test thoroughly when upgrading either the client or the server.
Ensure Java (version 8+) is installed, start the Tika server (manually or by ensuring 'tika-server.jar' is locatable), and verify that `TikaClient.TikaClient(url='...')` points to the correct server address and port.
Install Java Development Kit (JDK) 8 or higher and ensure `JAVA_HOME` is set or `java` is in your system's PATH. Alternatively, download `tika-server.jar` and specify its path explicitly: `from tika import config; config.TikaClient(jar_path='/path/to/tika-server.jar')`.
Install the library using pip: `pip install tika`
Import `parse` from the `tika.parser` submodule: `from tika.parser import parse`