This library uses Python to query the GLEIF.org's API.
Documentation
Full documentation, including the complete API reference, is available at pygleif.readthedocs.io.
[!NOTE]
pygleif.v1(PyGleif,Search) is deprecated. New code should usepygleif.v2(GleifClient), shown below.
Installing the library
pip install pygleif
To install the latest in-development version from main (may be ahead of the
last PyPI release):
pip install git+https://github.com/ggravlingen/pygleif.git@main
Example: fetching data for a specific LEI:
from pygleif import GleifClient
client = GleifClient()
response = client.get_lei_record("549300MLUDYVRQOOXS22")
# Print the name of the company with the LEI above
print(response.data.attributes.entity.legal_name.name)
# prints UK EQUITY FUND (OFFSHORE)
Example: search for a LEI using organisation number:
from pygleif import GleifClient
client = GleifClient()
response = client.search_fulltext("5560142720")
# Print the LEI of the company with the LEI above
print(response.data[0].attributes.lei)
# prints 213800T8PC8Q4FYJZR07
Example: iterating over a full result set
iter_search follows the API's pagination for you (async: aiter_search):
from pygleif import GleifClient
client = GleifClient(retries=2)
for record in client.iter_search(
filters={"entity.legalAddress.country": "SE"},
max_records=500,
):
print(record.attributes.lei, record.attributes.entity.legal_name.name)
Command line
The package also installs a pygleif console command:
$ pygleif get 5493001KJTIIGC8Y1R12
$ pygleif search "bank" --page-size 5
Async usage
Every GleifClient method has an a-prefixed async counterpart (e.g.
search_fulltext / asearch_fulltext), backed by httpx2:
import asyncio
from pygleif import GleifClient
async def main() -> None:
async with GleifClient() as client:
response = await client.aget_lei_record("549300MLUDYVRQOOXS22")
print(response.data.attributes.entity.legal_name.name)
asyncio.run(main())
Metadata
Release files for pygleif 2026.7.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pygleif-2026.7.3.tar.gz | 30.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pygleif-2026.7.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 65.5 kB
Release files / pygleif-2026.7.3.tar.gz
| Download URL | pygleif-2026.7.3.tar.gz |
|---|---|
| Size | 30.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6276c8943dd857c8003c80949c42e6596793356b9774871dd837f4d02a348668
|
|
BLAKE2b-256 checksum How to use checksums |
dfabfcf186cee74dc19615e419e8f5904dd66bff207e485a5abc42d8e7dd196f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / pygleif-2026.7.3-py3-none-any.whl
| Download URL | pygleif-2026.7.3-py3-none-any.whl |
|---|---|
| Size | 35.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
781373f6e4bdf3e2a8ac5b78e3cd81de1c440fd48f939458d0527124606d1096
|
|
BLAKE2b-256 checksum How to use checksums |
2b41f1985987d65659a5fcce3acd6255391fa939d084509a88a49ac710d7ed47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|