LEI Enricher
Batch-validate and enrich LEI codes from Excel / CSV files using the GLEIF API, with optional fallback provider.
Built for KYC / AML / compliance teams who maintain spreadsheets with Legal Entity Identifiers.
Features
- 🔍 GLEIF API — batched lookups (up to 200 LEIs per request), rate-limit friendly
- 💾 SQLite cache — configurable TTL (default 14 days), avoids redundant API calls
- 📊 Excel / CSV / ODS input & output
- 🖥️ Desktop GUI (PySide6) — optional, install with
[gui] - 🌐 Web-app ready — use
enrich_dataframe()directly in Flask / FastAPI / Celery - ⚡ CLI —
lei-enrich input.xlsx --output enriched.xlsx - 🔄 Fallback — optional HTML scrape of lei-lookup.com for GLEIF misses
Installation
Core (no GUI — suitable for servers & web apps)
pip install lei-enricher
With Desktop GUI
pip install "lei-enricher[gui]"
With ODS (LibreOffice Calc) support
pip install "lei-enricher[ods]"
With Flask web backend
pip install "lei-enricher[web]"
Everything
pip install "lei-enricher[all]"
Quickstart
As a Python library
import pandas as pd
from lei_enricher import enrich_dataframe
df = pd.read_excel("my_leis.xlsx")
result = enrich_dataframe(df)
result.to_excel("enriched.xlsx", index=False)
Single LEI lookup
from lei_enricher import GleifClient
client = GleifClient()
results = client.lookup_batch(["HWUPKR0MPOU8FGXBT394", "5493001KJTIIGC8Y1R12"])
for lei, info in results.items():
print(lei, info.entity_status, info.next_renewal_date)
CLI
lei-enrich input.xlsx --output enriched.xlsx
lei-enrich input.xlsx --lei-col "Company LEI" --sheet "Sheet1" --fallback
Desktop GUI
lei-enricher # requires: pip install "lei-enricher[gui]"
Flask web app (minimal example)
from flask import Flask, request, send_file
import pandas as pd
from lei_enricher import enrich_dataframe
import io
app = Flask(__name__)
@app.post("/enrich")
def enrich():
file = request.files["file"]
df = pd.read_excel(file)
result = enrich_dataframe(df)
buf = io.BytesIO()
result.to_excel(buf, index=False)
buf.seek(0)
return send_file(buf, download_name="enriched.xlsx", as_attachment=True)
enrich_dataframe() parameters
| Parameter | Default | Description |
|---|---|---|
df |
— | Input DataFrame with LEI column |
lei_col |
auto-detect | Column name containing LEI codes |
status_col |
"Entity Status" |
Output column for entity status |
renewal_col |
"Next Renewal Date" |
Output column for next renewal date |
cache_db |
~/lei_cache.sqlite |
SQLite cache path |
cache_days |
14 |
Cache TTL in days |
gleif_batch_size |
200 |
LEIs per GLEIF API request |
gleif_throttle_s |
0.2 |
Delay (seconds) between GLEIF batches |
fallback_enabled |
False |
Use lei-lookup.com for GLEIF misses |
fallback_throttle_s |
1.0 |
Delay (seconds) between fallback requests |
progress_callback |
None |
callback(done, total) for progress tracking |
Output columns
The enriched file adds two columns immediately to the right of the LEI column:
- Entity Status — e.g.
ACTIVE,LAPSED,MERGED,RETIRED - Next Renewal Date — ISO 8601 date string, e.g.
2025-12-31
Project structure
src/lei_enricher/
__init__.py — public API
core.py — GleifClient, LeiLookupFallback, LeiResult
cli.py — enrich_dataframe() + CLI entry point
cache.py — SQLite cache
io_excel.py — Excel/CSV/ODS read & write
gui.py — PySide6 desktop GUI (optional)
main.py — GUI entry point (optional)
tests/
License
GPL-3.0-or-later — see LICENSE.
Metadata
Release files for lei-enricher 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lei_enricher-0.1.0.tar.gz | 26.5 kB | Without provenance | Details for lei_enricher-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lei_enricher-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for lei_enricher-0.1.0-py3-none-any.whl |
Total release size: 52.4 kB
Release files / lei_enricher-0.1.0.tar.gz
| Download URL | lei_enricher-0.1.0.tar.gz |
|---|---|
| Size | 26.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
246a680985d71087c2b6a077d711aba02798ca75ee740308c0282bec29dd5e7d
|
|
BLAKE2b-256 checksum How to use checksums |
ce7306b68ae30175bf6347019f45a550b9e17a989a8b77edf74a0a42f6ed49bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / lei_enricher-0.1.0-py3-none-any.whl
| Download URL | lei_enricher-0.1.0-py3-none-any.whl |
|---|---|
| Size | 25.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f3b7015a3eac3188a6c7951eba0958e84aea92b2a90c8eeda062354ca3ae3a84
|
|
BLAKE2b-256 checksum How to use checksums |
16182efca166d89058bc6207fd4bfa20c855bbf710b5b651b3739a61bdb079bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for lei-enricher 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.
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.