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

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.3.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.3-py3-none-any.whl (35.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pygleif-2026.7.3.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.3.tar.gz
Algorithm Hash digest
SHA256 6276c8943dd857c8003c80949c42e6596793356b9774871dd837f4d02a348668
MD5 eff406178db539c19075bb5b64f8fd16
BLAKE2b-256 dfabfcf186cee74dc19615e419e8f5904dd66bff207e485a5abc42d8e7dd196f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pygleif-2026.7.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 781373f6e4bdf3e2a8ac5b78e3cd81de1c440fd48f939458d0527124606d1096
MD5 ccda2622428c09203fedc5d7739a39b0
BLAKE2b-256 2b41f1985987d65659a5fcce3acd6255391fa939d084509a88a49ac710d7ed47

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