Skip to main content

Query the GLEIF API using Python

Project description

PyPI version

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 use pygleif.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 httpx:

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())

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

pygleif-2026.7.2.tar.gz (30.1 kB view details)

Uploaded Source

Built Distribution

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

pygleif-2026.7.2-py3-none-any.whl (35.5 kB view details)

Uploaded Python 3

File details

Details for the file pygleif-2026.7.2.tar.gz.

File metadata

  • Download URL: pygleif-2026.7.2.tar.gz
  • Upload date:
  • Size: 30.1 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for pygleif-2026.7.2.tar.gz
Algorithm Hash digest
SHA256 17155e6f310de8dcc11f22f260453a312797f92625165a2f5e44616c80323739
MD5 293817b332fc6073c419c0d57b9e2df3
BLAKE2b-256 f7a311f4a59d375f6a7ca59dd677a0f5ce4aa492160c6e17f1ce8a7c7a72469f

See more details on using hashes here.

File details

Details for the file pygleif-2026.7.2-py3-none-any.whl.

File metadata

  • Download URL: pygleif-2026.7.2-py3-none-any.whl
  • Upload date:
  • Size: 35.5 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for pygleif-2026.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 22ce2a768531b3e54df046252754fdb5ead48c92036020df10a9ea0b950fc5a8
MD5 c583fa8ed0c2eec2009c816ff598eab0
BLAKE2b-256 cefc1926563864260d28813e203322722e0da7be7ad18a9bf7a5c0d56f863d04

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