Skip to main content

API client used to access Pngme's financial data APIs.

Project description

Pngme

Python API Client

This package exposes a synchronous and asynchronous client used to interact with Pngme's financial data APIs.

Install

Install the latest version with:

pip3 install pngme-api

Quick start

Create a Client instance using your API token found in the Pngme Dashboard:

from pngme.api import Client

token = "" # your API token
client = Client(token)

If you're using asyncio, you can import and use the AsyncClient instead. See using with asyncio.

We can list or search the available /users:

users = client.users.get()
users = client.users.get(search="2343456789012")

For a user of interest, we can get a list of the user's /institutions:

user_uuid = "33b6215d-3d75-4271-801c-6da27603a8be"

institutions = client.institutions.get(user_uuid=user_uuid)

Then for a given institution, we can get a list of the user's /transactions, /balances, or /alerts:

user_uuid = "33b6215d-3d75-4271-801c-6da27603a8be"
institution_id = "zenithbank"

transactions = client.transactions.get(user_uuid=user_uuid, institution_id=institution_id)
balances = client.balances.get(user_uuid=user_uuid, institution_id=institution_id)
alerts = client.alerts.get(user_uuid=user_uuid, institution_id=institution_id)

asyncio

We can make multiple requests concurrently using asyncio by creating a Client instance with your API token found in the Pngme Dashboard:

from pngme.api import AsyncClient

token = "" # your API token
client = AsyncClient(token)

Similar to the synchronous Client, we can list or search the available /users:

async def get_users(client: AsyncClient):
    users = await client.users.get()
    return users

users = asyncio.run(get_users(client))

This is helpful to concurrently execute multiple requests, such as fetching a user's transaction history across all accounts by iterating over institutions associated with a user:

async def get_transactions(client: AsyncClient, user_uuid: str):
    # Find institutions where the user has one or more accounts
    institutions = await client.institutions.get(user_uuid)

    # Concurrently fetch transactions for all institutions
    institution_ids = [institution.institution_id for institution in institutions]
    coroutines = [
        client.transactions.get(user_uuid, institution_id)
        for institution_id in institution_ids
    ]
    transactions = await asyncio.gather(*coroutines)

    # Associate transactions with the relevant institution_id
    return dict(zip(institution_ids, transactions))

user_uuid = "33b6215d-3d75-4271-801c-6da27603a8be"
transactions = asyncio.run(get_transactions(client, user_uuid))

Next steps

  • Browse the Pngme Feature Library to see how data scientists integrate our APIs into decisioning workflows
  • Explore the definitions of each response field in the API Docs

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

pngme_api-0.14.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

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

pngme_api-0.14.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file pngme_api-0.14.0.tar.gz.

File metadata

  • Download URL: pngme_api-0.14.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.10.9 Linux/5.15.0-1024-azure

File hashes

Hashes for pngme_api-0.14.0.tar.gz
Algorithm Hash digest
SHA256 309d7b8c626ba18ba3009499822deaa729c5d29abbfbfd8cdb6f9db7b154856a
MD5 03bc338e3106d3149f4e7426a81976d1
BLAKE2b-256 489d2af0c400783c3d7fec6a93a59ef3126b727e996c9d97078b8648268bc139

See more details on using hashes here.

File details

Details for the file pngme_api-0.14.0-py3-none-any.whl.

File metadata

  • Download URL: pngme_api-0.14.0-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.10.9 Linux/5.15.0-1024-azure

File hashes

Hashes for pngme_api-0.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a5cca12fda8d9bbb95adec7f43d6e444c0c73d036b0f56957145da7f760ab11
MD5 880f2dcabde4913d7cdb86ce801bfd66
BLAKE2b-256 20abde0636d31b2b01b12dce5b2b7989a373b40a70f923e83170ab14fa3fa212

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