Skip to main content

A python wrapper / client for GLEIF public API.

Project description

LEIPY

A python wrapper / client for GLEIF public API. Suggestions, requests, contributions welcome.

(I started this as a hobby / learning project, so it's rough around the edges. If you are looking for a better solution, check out pygleif)

Dependencies

  1. Python >= 3.4
  2. requests: For API requests
  3. dateutil: For correctly parsing dates as datetime objects
  4. pandas: Optional, for returning output as DataFrame

Usage

Import, instantiate and make the request:

from leipy import GLEIF

gleif = GLEIF(api_version='v1')

raw_output, results, results_df = gleif.request(
    ['HWUPKR0MPOU8FGXBT394','7ZW8QJWVPR4P1J1KQY45'], 
    return_dataframe=True
)

After that, you can access the raw output from the API, results as a class with easy to access instance members, and results as a pandas DataFrame

Raw output example

[{'LEI': {'$': 'HWUPKR0MPOU8FGXBT394'},
  'Entity': {'LegalName': {'$': 'Apple Inc.'},
   'LegalAddress': {'Line1': {'$': 'C/O C T Corporation System'},
    'Line2': {'$': '818 West 7th Street'},
    'Line3': {'$': 'Suite 930'},
    'City': {'$': 'Los Angeles'},
    'Region': {'$': 'US-CA'},
    'Country': {'$': 'US'},
    'PostalCode': {'$': '90017'}},
   'HeadquartersAddress': {'Line1': {'$': '1 Infinite Loop'},
    'City': {'$': 'Cupertino'},
    'Region': {'$': 'US-CA'},
    'Country': {'$': 'US'},
    'PostalCode': {'$': '95014'}},
   'BusinessRegisterEntityID': {'@register': 'RA000598', '$': 'C0806592'},
   'LegalJurisdiction': {'$': 'US'},
   'LegalForm': {'$': 'INCORPORATED'},
   'EntityStatus': {'$': 'ACTIVE'}},
  'Registration': {'InitialRegistrationDate': {'$': '2012-06-06T15:53:00.000Z'},
   'LastUpdateDate': {'$': '2017-12-12T21:19:00.000Z'},
   'RegistrationStatus': {'$': 'ISSUED'},
   'NextRenewalDate': {'$': '2018-12-13T00:31:00.000Z'},
   'ManagingLOU': {'$': 'EVK05KS7XY1DEII3R011'},
   'ValidationSources': {'$': 'FULLY_CORROBORATED'}}},
 {'LEI': {'$': '7ZW8QJWVPR4P1J1KQY45'},
  'Entity': {'LegalName': {'$': 'Google LLC'},
   'LegalAddress': {'Line1': {'$': 'C/O Corporation Service Company'},
    'Line2': {'$': '251 Little Falls Drive'},
    'City': {'$': 'Wilmington'},
    'Region': {'$': 'US-DE'},
    'Country': {'$': 'US'},
    'PostalCode': {'$': '19808'}},
   'HeadquartersAddress': {'Line1': {'$': '1600 Amphitheatre Parkway'},
    'City': {'$': 'Mountain View'},
    'Region': {'$': 'US-CA'},
    'Country': {'$': 'US'},
    'PostalCode': {'$': '94043'}},
   'BusinessRegisterEntityID': {'@register': 'RA000602', '$': '3582691'},
   'LegalJurisdiction': {'$': 'US'},
   'LegalForm': {'$': 'LIMITED LIABILITY COMPANY'},
   'EntityStatus': {'$': 'ACTIVE'}},
  'Registration': {'InitialRegistrationDate': {'$': '2012-06-06T15:52:00.000Z'},
   'LastUpdateDate': {'$': '2018-03-28T17:00:00.000Z'},
   'RegistrationStatus': {'$': 'ISSUED'},
   'NextRenewalDate': {'$': '2018-08-17T18:10:00.000Z'},
   'ManagingLOU': {'$': 'EVK05KS7XY1DEII3R011'},
   'ValidationSources': {'$': 'FULLY_CORROBORATED'}}}]

Results class example

>>> print(results.legal_name)
['Apple Inc.', 'Google LLC']

>>> print(results.lei_reg_status)
['ISSUED', 'ISSUED']

>>> print(results.date_last_updated)
[datetime.datetime(2017, 12, 12, 21, 19, tzinfo=tzutc()),
 datetime.datetime(2018, 3, 28, 17, 0, tzinfo=tzutc())]

Results DataFrame example

>>>results_df
country_hq country_legal date_initial_reg date_last_updated date_next_renewal legal_name lei lei_reg_status status
0 US US 2012-06-06 15:53:00+00:00 2017-12-12 21:19:00+00:00 2018-12-13 00:31:00+00:00 Apple Inc. HWUPKR0MPOU8FGXBT394 ISSUED ACTIVE
1 US US 2012-06-06 15:52:00+00:00 2018-03-28 17:00:00+00:00 2018-08-17 18:10:00+00:00 Google LLC 7ZW8QJWVPR4P1J1KQY45 ISSUED ACTIVE

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

leipy-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

leipy-0.1.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file leipy-0.1.0.tar.gz.

File metadata

  • Download URL: leipy-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for leipy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 50ce69046462321f35d3fe02fe2f1a5918d1fe6e8e19155a7652d6546ff414b1
MD5 04fb9d380bcf4b5fc24c3b1cb7d59d06
BLAKE2b-256 42a833d759069dbef43a5f0e0221b1f75dd301c114445a90159e83019d0e56ec

See more details on using hashes here.

File details

Details for the file leipy-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for leipy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3bf9da54908a2614157056edcf40775cbfdf576c083ca73be48f13f4cd8ea6cd
MD5 e5d65d27d88d1951793b7ace8e4652a5
BLAKE2b-256 98c7efb1725c16d12229af7d59cc03d7c3c8512de142d5fc8b4edab435d8244c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page