Skip to main content

statement-fetch

Zero-LLM-in-Bank async financial statement fetcher, structural validator, and pluggable sink runner.

Security Model ("Zero-LLM-in-Bank")

  1. Human sign-in: A real Chromium browser opens the institution's login URL. The human completes authentication and 2FA; no credentials or LLM tokens touch the bank session.
  2. Host confinement: Top-level navigations, HTTP 3xx redirects (single/multi-hop and POST), target="_blank" popups, and in-page fetch_bytes() calls are confined to the provider's declared allowed_hosts via Chromium CDP Fetch.enable and context routing.
  3. Deterministic fetch & atomic staging: After is_logged_in() succeeds, deterministic provider code downloads statements into a per-run 0o700 staging directory, validates every artifact using its declared validator (defaulting to non-empty; built-in validators cover PDF, CSV, JSON, and bounded ZIP), writes 0o600 artifacts with SHA-256 digests, and produces a portable manifest.json.
  4. Guaranteed logoff & pluggable sinks: logoff() and browser teardown run in finally: even on error or Ctrl-C. Sinks (statement_fetch.sinks) verify every manifest entry and SHA-256 before delivering.

Installation

Requires Python 3.11+:

pip install "statement-fetch[playwright]"
playwright install chromium

Quickstart (Demo Portal, From a Clone)

Install Chromium into the project environment:

uv run --extra playwright playwright install chromium

In one terminal, start the bundled zero-dependency loopback demo bank:

uv run python -m statement_fetch.demo --port 8765

In another terminal, fetch statements and export them to a local directory with an immutable receipt manifest:

uv run --extra playwright statement-fetch fetch example-bank \
  --opt base_url=http://127.0.0.1:8765 \
  --upload --sink dir --sink-dir ./exported

Verify a staged or exported manifest offline:

uv run statement-fetch upload ./exported/manifest-*.json --local-only --json

Plugin API (API_VERSION = 1)

Third-party providers and sinks import from statement_fetch.api (or top-level statement_fetch) and register via Python entry points:

[project.entry-points."statement_fetch.providers"]
my-bank = "my_pkg.provider:MyBankProvider"

[project.entry-points."statement_fetch.sinks"]
my-sink = "my_pkg.sink:MySink"
  • Reference provider: src/statement_fetch/providers/example_bank.py
  • Reference sink: src/statement_fetch/sinks/directory.py
  • Versioning: the entry-point group names (statement_fetch.providers, statement_fetch.sinks) define the API_VERSION = 1 compatibility boundary.

CLI Exit Codes & Manifest Schema

  • Exit codes: 0 (EXIT_OK, ok/empty), 1 (EXIT_ERROR), 2 (EXIT_USAGE), 3 (EXIT_LOGIN_TIMEOUT), 4 (EXIT_PARTIAL), 130 (interrupted / Ctrl-C).
  • manifest.json (schema_version = 1): schema_version, api_version, tool_version, created_at, provider, period_start, period_end, artifacts[] (artifact_id, name, path relative to manifest dir, sha256, bytes, provider, kind, period, valid, optional currency/error/observed_start/observed_end/meta), skipped[], errors[], timings_s.

Development Checks

make check

Metadata

Release files for statement-fetch 0.5.0

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

Source distribution (sdist)

Source distribution for statement-fetch 0.5.0
File Size Uploaded Provenance Actions
statement_fetch-0.5.0.tar.gz 64.2 kB Without provenance Details for statement_fetch-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for statement-fetch 0.5.0
File Interpreter ABI Platform Actions
statement_fetch-0.5.0-py3-none-any.whl Python 3 none any Details for statement_fetch-0.5.0-py3-none-any.whl

Total release size: 109.6 kB

Release files / statement_fetch-0.5.0.tar.gz

Download URL statement_fetch-0.5.0.tar.gz
Size 64.2 kB
Tags Source
SHA-256 checksum
How to use checksums
14f294d48a7aab3af324355bcd13bc86c8b520ec5d8a1255fa8e01b1c0ad240f
BLAKE2b-256 checksum
How to use checksums
a4eed11a7a31357b9898c9c44c465e21da7fba42e85633508954c17b18f25730
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / statement_fetch-0.5.0-py3-none-any.whl

Download URL statement_fetch-0.5.0-py3-none-any.whl
Size 45.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a379b2d705d2b395236aa1aa9a7d5de97aa9769ec1ea9be242490dbbdd4ab320
BLAKE2b-256 checksum
How to use checksums
f448dc3bd7368e4d4f609d6f743c63ca194ae33c0919b8a762ee9dbd1c5e8a88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for statement-fetch 0.5.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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