Skip to main content

Official Python client for the LocalParse document-parsing API (LlamaParse-compatible).

Project description

LocalParse — Python client

Official Python client for the LocalParse document-parsing API. LocalParse is a drop-in LlamaParse-compatible parser with a deterministic accuracy layer: table-detection recovery (catches tables a layout model misses) and oracle-free financial-identity checks (flags Totals that don't reconcile).

Install

pip install localparse

Quickstart

from localparse import LocalParse

client = LocalParse(api_key="lp-...")          # or set LOCALPARSE_API_KEY

result = client.parse("invoice.pdf", result_type="markdown")
print(result.markdown)

# Accuracy signal that plain OCR/LLM parsers don't give you:
print(result.identity_check)     # {tables_checked, violations, ...} or None
print(result.recovered_tables)   # tables recovered by detect_repair

Fetch JSON or the ingestion-ready structured contract instead:

result = client.parse("10k.pdf", result_type="json")
for page in result.pages:
    ...

structured = client.parse("10k.pdf", result_type="structured")

Persist a whole folder (incremental)

Ingest a data room into a named case; re-runs only parse new/changed files (unchanged files are skipped by content hash):

results = client.parse_folder(
    "./data-room",
    case_id="acme",
    resume=True,
    on_progress=lambda path, res: print("parsed" if res else "skipped", path),
)

Full control (async jobs)

job = client.upload("big.pdf", result_type="json", case_id="acme")
job = client.wait(job.id)
if job.is_success:
    result = client.get_result(job.id, "json")

Configuration

Argument Default Meaning
api_key LOCALPARSE_API_KEY env Bearer token for the API.
base_url https://api.localparse.com Point at a self-hosted instance if needed.
timeout 60 Per-request HTTP timeout (seconds).
poll_interval 2.0 Seconds between status polls in parse/wait.
max_wait 900 Max seconds to wait for a job before JobTimeoutError.

Errors

AuthenticationError (401/403), QuotaExceededError (402), NotFoundError (404), RateLimitError (429, with .retry_after), APIError (other non-2xx), JobFailedError (job ended ERROR/CANCELED), JobTimeoutError — all subclass LocalParseError.

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

localparse-0.1.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

localparse-0.1.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file localparse-0.1.0.tar.gz.

File metadata

  • Download URL: localparse-0.1.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for localparse-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3084ff932aa65aa0fd34b6ca6a0f91b3c94d6a64b9c148302aee4b9e33b5052e
MD5 fd6ef80a87ba1575e0cbc4d501ac0859
BLAKE2b-256 2d3aa3ae6b352090a6f931d328eb16589c568e6a80352bc0ad6436c068b336dd

See more details on using hashes here.

File details

Details for the file localparse-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: localparse-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for localparse-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5941224ab874f1f468e3e65f764be41aa7ce679e9389f0afe09adbcc6c16150f
MD5 0f23eaec46174b928792a5ebba8ad434
BLAKE2b-256 9325a50176713845ad12b641ccab40aad630a20ece87e2cc1165d779aedc3986

See more details on using hashes here.

Supported by

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