Skip to main content

liquilens

Python client for the LiquiLens public API.

LiquiLens publishes research screens over public records about Indian lenders. Every institution, place and publisher it describes has one canonical id, such as inst:in/rbi/dena-bank, with the keys each dataset uses for it (a CIN, an RBI label, a geography id) and typed links between them. This package reads that free identity layer, follows succession links to the identity that carries an institution today, and builds portable identity bundles in CSV, Parquet or DuckDB that join to your own data on the same ids.

The package holds no scoring or engine logic. Every answer comes from the public HTTP API at https://api.liquilens.in, and the package keeps nothing on disk unless you ask it to build a bundle.

  • Typed results for resolve, describe, links, current_identity and census
  • Typed errors: KeyRequired (401), PaidKeyRequired (402), RateLimited (429) and more
  • Retries with exponential backoff for 429 and 5xx, honouring Retry-After
  • An OData identity feed reader that follows every page
  • liquilens bundle build, with a manifest validated against the published bundle schema

An OpenBB provider lives in integrations/openbb as the separate distribution openbb-liquilens.

Install

pip install liquilens

Optional extras keep the core install light (httpx and jsonschema only):

pip install "liquilens[pandas]"    # FeedResult.to_pandas()
pip install "liquilens[parquet]"   # Parquet bundles (pyarrow)
pip install "liquilens[duckdb]"    # DuckDB bundles

Python 3.10 or later. To install from a checkout instead: pip install .

Quickstart

from liquilens import Client

with Client() as ll:  # reads LIQUILENS_API_KEY when it is set
    hit = ll.resolve("Dena Bank")
    hit.status, hit.id, hit.rule  # ('resolved', 'inst:in/rbi/dena-bank', 'rbi_label')

    ll.resolve("Aurangabad").candidates  # two districts share the name: ambiguous, never guessed
    ll.resolve("No Such Lender").status  # 'not_found': nothing is minted for an unknown name

    dena = ll.describe(hit.id)
    dena.label, dict(dena.keys)  # ('Dena Bank', {'rbi_label': 'Dena Bank'})
    for link in dena.links_in:  # links are src -> dst, each with its basis in note
        print(link.src, link.kind, link.dst, link.note)

    today = ll.current_identity(hit.id)
    today.id, today.chain  # follows the dated 'succeeds' link to Bank of Baroda
    today.stopped  # 'no_successor'

    census = ll.census()  # counts the API generates, by kind and key space
    census.by_kind, census.key_spaces

Resolution never guesses. status is resolved, ambiguous (the candidates are listed and none is picked) or not_found; the last two are results, not errors. current_identity stops and returns the candidates when a predecessor has more than one successor, and says so in stopped when the API capped the links it could check.

A predecessor keeps its own id and every figure printed under its name. Join on canonical ids or keys, never on labels.

OntologyObject.note is the API's free-text context exactly as served. The identity feed, the bundles and the OpenBB provider show only its type code and registered city or state.

The OData identity feed

from liquilens import Client, quote_literal

with Client() as ll:
    banks = ll.feed("Institutions", filter=f"Category eq {quote_literal('Small finance bank (SFB)')}")
    banks.rows[0]["Id"], banks.total, banks.complete
    frame = banks.to_pandas()  # needs liquilens[pandas]

The feed has four entity sets: Institutions, Places, Publishers and Links. feed() follows every @odata.nextLink, always from your configured origin, so a key is never sent to a host named inside a response. Build string literals with quote_literal, never by pasting text into a filter.

Identity bundles

liquilens bundle build ./ll-identity                                # CSV
liquilens bundle build ./ll-identity --format parquet --format duckdb --overwrite
liquilens bundle verify ./ll-identity
from liquilens.bundle import build_bundle, verify_bundle

result = build_bundle("./ll-identity", formats=["csv", "duckdb"])
result.partial, result.reasons
verify_bundle(result.path).ok

A bundle folder holds:

File Contents
objects One row per object: id, kind, label, jurisdiction, authority, note
keys One row per (object_id, space, key)
aliases One row per (object_id, alias)
links One row per link: src, kind, dst, note (the link's basis)
manifest.json Build time, the API's source commit, transaction-time horizon, row counts and the sha256 of every file
rights-rule.json The rights rule the bundle applied; its sha256 is the manifest's register_sha256
NOTICE.txt What the bundle is, whether it is complete, and how to verify it

The tables follow the bundle layout of the LiquiLens ontology specification (version 1, section 9.2), with the same ids the API serves. CSV writes one file per table, Parquet one file per table, DuckDB one liquilens.duckdb database with all four tables and primary keys that enforce their invariants.

Notes on the columns:

  • jurisdiction and authority are the id's own lowercase segments (in, rbi), as the id grammar defines them.
  • note is the feed's plain-English category for an institution and the level (state, district) for a place.
  • The feed joins aliases with "; ", and the builder splits them on that separator.
  • The feed leaves out every object, key and link known only through a source that may not be redistributed in bulk. describe still serves those one at a time.

The manifest validates against the published bundle-manifest.schema.json, which the package vendors. It records spec_version 1.0, because the bundle section of the specification is a proposal for version 1.1 that has not been released. source_commit comes from the API's GET /api/v1/release/identity; if the API releases a new version while a bundle is being read, the build stops rather than mix two versions. A bundle holds identity only, no facts, so commercial_only is false and no source verdict was applied; rights-rule.json states that rule.

Without a key a bundle is partial, and says so. The feed gives a caller without a key the first 50 positions of any query and a daily budget of 500 rows, so a keyless build is a sample of each entity set. The manifest sets scope.partial with a reason per entity set, NOTICE.txt opens with Status: PARTIAL, and the command prints the same. With a key, every page is followed and the bundle is complete. The API key is never written to a bundle.

What is free and what needs a key

Free, without a key (within rate limits): the identity layer. Canonical ids, names, keys, aliases, typed links and the census, through resolve, describe, links, current_identity and census, plus the OData identity feed for lookups: the first 50 positions of any query and 500 rows a day, with no range comparisons or ordered walks.

Needs an API key:

  • The whole identity feed in bulk, every row and every query option: a free key.
  • Facts, point-in-time (as-of) history and bulk depth on the research routes: a free or a paid key, depending on the sources a response cites.
  • The source link behind each figure: a paid key.

Version 0.1.0 of this client reads only the identity layer. The API names anything it withholds: OntologyObject.access, Census.access and FeedResult.access carry its note, and a refused request raises KeyRequired or PaidKeyRequired with the API's own how_to_get_access text. The limits above are the API's at the time of writing; the API's notes are authoritative. For a key, see liquilens.in.

Set the key in the environment rather than in code:

export LIQUILENS_API_KEY=llk_v1_...

Examples

Two notebooks in examples/ call the live free endpoints. They are committed without outputs, so this repository redistributes no figures; run them to see results.

  • 01_resolve_your_institution_list.ipynb: resolve a list of Indian lender names to canonical ids, keep ambiguous and unknown names as results, follow succession links, and see where point-in-time facts need a key.
  • 02_real_signal_or_noise.ipynb: ask whether a public money-market spread from Seiche really changed, with NoiseFloor's change tests, and how the same tests apply to LiquiLens lender panels named by canonical id.
pip install . noisefloor jupyterlab    # from a checkout
jupyter lab examples/

Without a key neither notebook calls a route that needs one. Drafts for publishing the identity bundle on Hugging Face and Kaggle are in datasets/; nothing has been uploaded.

Excel and Power BI

The identity feed is an OData v4 service, so Excel and Power BI read it without an add-in.

Feed URL:

https://api.liquilens.in/api/experimental/v1/ontology/odata

Excel (Microsoft 365, Windows): Data > Get Data > From Other Sources > From OData Feed. Paste the feed URL, choose Anonymous, then pick Institutions, Places, Publishers or Links in the Navigator and load them. Excel for Mac offers the OData feed source only in some builds; check yours before relying on it.

Power BI Desktop: Get data > OData feed, paste the feed URL, choose Anonymous, and pick the tables.

Join your sheets on the Id column. To attach your own list of lenders, resolve each name or CIN once (liquilens resolve "Dena Bank") and keep the returned id.

Without a key each table loads its first 50 rows. To load every row with a key, add the header in Power Query's Advanced Editor, keeping the key in a Power Query parameter rather than in the query text:

OData.Feed(
    "https://api.liquilens.in/api/experimental/v1/ontology/odata/Institutions",
    [Authorization = "Bearer " & LiquiLensKey]
)

Do not share a workbook that holds a key.

Errors

Exception When
KeyRequired HTTP 401: the request needs a free API key, or the keyless allowance is used up
PaidKeyRequired HTTP 402: the request needs a paid API key
RateLimited HTTP 429 after retries; retry_after holds the API's wait in seconds
ObjectNotFound describe of an id no object has
NotFound, InvalidRequest, ServerError, APIError Other HTTP errors
TransportError Connection failures and timeouts after retries
UnexpectedResponse A response this client does not recognise

KeyRequired and PaidKeyRequired are AccessErrors and carry depth, what, requires, tier, message and how_to_get_access when the API sent them. Every error derives from LiquiLensError.

Retries and limits

Client(
    api_key=None,  # or LIQUILENS_API_KEY
    base_url=None,  # or LIQUILENS_BASE_URL, else https://api.liquilens.in
    timeout=30.0,
    retries=3,  # timeouts, network errors, 429 and 5xx
    backoff=0.5,  # 0.5 s, 1 s, 2 s ... capped at 30 s
    max_retry_wait=60.0,  # a longer Retry-After is raised as RateLimited at once
)

A daily allowance refusal carries a long Retry-After; the client raises it instead of sleeping.

Security and privacy

  • The key is read from the api_key argument or LIQUILENS_API_KEY, sent only to the configured origin as Authorization: Bearer, never logged, never shown in repr, and never written to a bundle. The command line reads it from the environment only.
  • base_url must be HTTPS (plain HTTP only on a loopback address) and a bare origin.
  • Redirects are never followed, responses are size-capped, and paging links are requested from the configured origin only.
  • If the API reports that it did not accept a key, the client warns once (LiquiLensWarning).

See SECURITY.md to report a vulnerability.

Development

python -m pip install -e . --group dev        # pip 25.1 or later
pytest                                        # offline: every request is mocked
ruff check . && ruff format --check . && mypy
LIQUILENS_LIVE=1 pytest tests/test_live.py    # about ten requests to the real API

The tests never touch the network unless LIQUILENS_LIVE=1 is set. The OpenBB provider has its own tests under integrations/openbb/tests.

Licence

MIT, see LICENSE. Data served by the API stays subject to the terms LiquiLens and its sources state for it.

Metadata

Release files for liquilens 0.1.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 liquilens 0.1.0
File Size Uploaded Provenance Actions
liquilens-0.1.0.tar.gz 230.1 kB With provenance Details for liquilens-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for liquilens 0.1.0
File Interpreter ABI Platform Actions
liquilens-0.1.0-py3-none-any.whl Python 3 none any Details for liquilens-0.1.0-py3-none-any.whl

Total release size: 434.8 kB

Release files / liquilens-0.1.0.tar.gz

Download URL liquilens-0.1.0.tar.gz
Size 230.1 kB
Tags Source
SHA-256 checksum
How to use checksums
65c0b6ff835c675a7589449cce15868cb957793d907a9fc2413475aa2ddd4dc3
BLAKE2b-256 checksum
How to use checksums
db05451cd25b4b8bd904a1137fb5676dd50176be8d077fe673250087bb9b711f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 12, 2026.

Transparency log

Release files / liquilens-0.1.0-py3-none-any.whl

Download URL liquilens-0.1.0-py3-none-any.whl
Size 204.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79da97c91fd3650361a16a6a4904c5cbb2720b01e7a64a036d7a24bc09d43781
BLAKE2b-256 checksum
How to use checksums
42a03661ceb9d1798fba5d82b8c855657c8c1cc02beb9b3387ac7166a878820e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 12, 2026.

Transparency log

Security for liquilens 0.1.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for liquilens-0.1.0.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 Nov 12, 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