Skip to main content

Python client for the NCUA Credit Union Mapping API

Project description

pyncua

CI License: MIT pre-commit

Python client for the NCUA Credit Union Mapping API. Search credit union offices by name, charter number, or address; retrieve full institutional profiles; run advanced filtered searches; download call reports and profiles as PDF.

Provides both synchronous and asynchronous clients with typed Pydantic v2 response models.

Inspired by ContinuityControl/ncua, a Ruby gem that wrapped NCUA's now-retired ASP.NET endpoint. pyncua is not a fork — it is a complete rewrite in Python targeting NCUA's current JSON API at mapping.ncua.gov/api.

Install

pip install pyncua

Requires Python 3.10+.

Quick Start

from pyncua import NCUAClient

with NCUAClient() as client:
    # Search offices by name
    result = client.find_offices_by_name("Navy Federal")
    for office in result.offices:
        print(f"{office.credit_union_name}{office.city}, {office.state}")

    # Get full credit union details
    details = client.get_credit_union(5536)
    print(f"{details.name}: {details.assets_formatted} in assets, {details.members_formatted} members")

    # Advanced filtered search
    from pyncua import CUType, CUStatus
    results = client.search_credit_unions(
        cu_type=CUType.FEDERAL,
        status=CUStatus.ACTIVE,
        state="VA",
    )
    for cu in results.results:
        print(f"  {cu.name} (#{cu.charter_number}) — {cu.city}, {cu.state}")

API Coverage

Method Description
find_offices_by_name(name) Search office locations by credit union name
find_offices_by_charter(charter) Search office locations by charter number
find_offices_by_address(address, radius) Search offices near an address/zip
get_credit_union(charter) Full institutional profile by charter number
search_names(name) Lightweight name autocomplete
search_credit_unions(...) Advanced filtered search (type, status, region, state, etc.)
get_online_credit_unions() List online-only credit unions
download_call_report(charter, cycle_date) Download call report PDF
download_profile(charter, cycle_date) Download profile PDF
get_api_version() NCUA API version string
get_current_cycle() Current reporting cycle date
get_cycle_years() Available years for event data
get_merger_query_years() Available years for merger data

All search methods support skip/take pagination. find_offices_by_* methods accept boolean filter kwargs (atm, drive_thru, bilingual, etc.).

Async

from pyncua import AsyncNCUAClient

async with AsyncNCUAClient() as client:
    result = await client.find_offices_by_name("Navy Federal")

The async client mirrors the sync API exactly.

Error Handling

from pyncua import NCUAClient, NCUANotFoundError, NCUAValidationError

with NCUAClient() as client:
    try:
        details = client.get_credit_union(9999999)
    except NCUANotFoundError:
        print("Charter number not found")
    except NCUAValidationError:
        print("Invalid request")

Acknowledgments

This project was inspired by ContinuityControl/ncua, a Ruby gem by ContinuityControl that provided the original idea for wrapping the NCUA's credit union data API. While pyncua is an independent, ground-up implementation in Python (not a fork or port), the ContinuityControl team's work demonstrated the value of a clean client library for this data and motivated this project.

License

MIT

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

pyncua-1.0.1.tar.gz (53.8 kB view details)

Uploaded Source

Built Distribution

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

pyncua-1.0.1-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file pyncua-1.0.1.tar.gz.

File metadata

  • Download URL: pyncua-1.0.1.tar.gz
  • Upload date:
  • Size: 53.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for pyncua-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ee0807eb3be716f51952c6f4f3b85087fb905005398c284755b55cb5aaecb959
MD5 915ea62c9e22ccdbfe35be924e049987
BLAKE2b-256 c97f5b7eb313548c80a840ec4b05018d36edd47961ff5ad54f35da1fe618a486

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyncua-1.0.1.tar.gz:

Publisher: publish.yml on Avicennasis/pyncua

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyncua-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyncua-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for pyncua-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 04118b7047aa6947cd5e199b9af80985b83bb360836f6469c1768bcc6f2bddc5
MD5 63f872f5477c2862be6e2747ca7f0024
BLAKE2b-256 3ab385d2706e3dad30694d11b46e431a693e73ac795bffc01face9e6a4eb2c40

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyncua-1.0.1-py3-none-any.whl:

Publisher: publish.yml on Avicennasis/pyncua

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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