Skip to main content

Python wrapper for the HCB v3 API

Project description

uv Ruff

hcb

hcb is a Python 3.10+ wrapper library for the Hack Club Bank v3 API. It provides typed access to organizations, transactions, cards, donations, and other financial data with both synchronous and asynchronous support.

Installation

hcb is available on PyPI and can be installed with any package manager:

pip install hcb
# or
poetry add hcb
# or
uv add hcb

You can also install it from source:

pip install git+https://github.com/trag1c/hcb.git

Usage

Basic example

import hcb

for txn in hcb.get_organization_transactions("hq"):  # Hack Club HQ
    print(txn.memo, txn.amount_cents)

# or
hq = hcb.get_organization("hq")

for txn in hq.get_transactions():
    print(txn.memo, txn.amount_cents)

Expanding nested objects

By default, related objects like donations, cards, and users are returned as None. Use the expand parameter to fetch them:

# Without expand, nested objects have very little data:
txn = hq.get_transactions()[0]
print(txn.card_charge.date)  # None

# With expand, a lot more donation data is included:
txn = hq.get_transactions(expand="card_charge")[0]
print(txn.card_charge.date)  # 2026-03-22 00:00:00


# Multiple objects can be expanded by separating them with commas:
txn = hq.get_transactions(expand="donation,user,organization")[0]

Asynchronous usage

All functions have async equivalents prefixed with async_:

import asyncio
import hcb


async def main() -> None:
    ghostty = await hcb.async_get_organization("ghostty")
    transactions = await ghostty.async_get_transactions(expand="donation")
    for txn in transactions:
        if donation := txn.donation:
            print(f"Donation: ${donation.amount_cents / 100:.2f}")


asyncio.run(main())

API reference

See core.py.

License

hcb is licensed under the MIT License. © trag1c, 2026

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

hcb-1.0.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

hcb-1.0.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file hcb-1.0.0.tar.gz.

File metadata

  • Download URL: hcb-1.0.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hcb-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5af024f558a7ec2ad67fb8213b1a197a23a603fbd544fa01285e69ab8923f637
MD5 fb0c17878199f4ed4d0de453f09b09d1
BLAKE2b-256 d9af1b169c772a0da9bc2c3e8e6fc9955cf2d0127ddc4a83f04cd184770c6881

See more details on using hashes here.

File details

Details for the file hcb-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: hcb-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hcb-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22917f98ceb0663a933a0948e9dc22d0bd66c8979d7073dd4d924d9e2c134039
MD5 23ef2a41e40890cb5810908cf1e3469b
BLAKE2b-256 6ad0dbf2af58e10160e730b1229225bac1898a8578ffc07eed0547051ebb65b1

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