Skip to main content

Official Python SDK for HelloLedger API

Project description

HelloLedger Python SDK

Official Python SDK for the HelloLedger API. This SDK enables developers to integrate HelloLedger programmatically using API keys.

Installation

pip install helloledger

Quick Start

from helloledger import HelloLedger

# Initialize the client with your API credentials
client = HelloLedger(
    client_id="hl_live_abc123",
    secret_token="sk_live_xyz789",
    api_base="https://hlapi.azurewebsites.net"  # Optional, defaults to production
)

# List all companies accessible by your API key
companies = client.companies.list()

# Get a specific company
company = client.companies.get(company_id=123)

# List transactions for a company
transactions = client.transactions.list(company_id=123)

# Optional: Filter transactions by date
transactions = client.transactions.list(
    company_id=123,
    start_date="2025-01-01",
    end_date="2025-12-31"
)

Authentication

The SDK uses HTTP Basic Authentication with your API key credentials. You need to:

  1. Sign up for a HelloLedger account
  2. Generate an API key (client_id + secret_token)
  3. Initialize the client with your credentials

Important: Keep your secret_token secure and never commit it to version control.

Error Handling

The SDK raises custom exceptions for different error scenarios:

from helloledger import HelloLedger
from helloledger.exceptions import (
    AuthenticationError,
    PermissionError,
    NotFoundError,
    APIError
)

client = HelloLedger(client_id="...", secret_token="...")

try:
    company = client.companies.get(company_id=123)
except NotFoundError:
    print("Company not found or not accessible")
except PermissionError:
    print("Your API key doesn't have access to this company")
except AuthenticationError:
    print("Invalid API credentials")
except APIError as e:
    print(f"API error: {e.message} (Status: {e.status_code})")

Available Methods (Phase 1 - MVP)

Companies

  • client.companies.list() - List all accessible companies
  • client.companies.get(company_id) - Get a specific company

Transactions

  • client.transactions.list(company_id, **kwargs) - List transactions for a company
    • Optional parameters: start_date, end_date, limit, offset

Context Manager

You can use the client as a context manager to ensure proper cleanup:

with HelloLedger(client_id="...", secret_token="...") as client:
    companies = client.companies.list()
    # Client is automatically closed when exiting the context

Requirements

  • Python 3.8+
  • httpx >= 0.24.0

License

MIT

Support

For issues, questions, or feature requests, please visit:

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

helloledger-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

helloledger-0.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: helloledger-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for helloledger-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b7de26931dc9858c65eb727ce7539b5df9bbd0c2d07fb88aa71e0e0b509127ea
MD5 4b091079e036ed499fd37f2371552125
BLAKE2b-256 5f75b045c5a6b715281fe97872bad2807c4a3b625fc0f2e9f1f60015ba8108e2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: helloledger-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for helloledger-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 80477923cac9aaf8c151a69a3e61ba72cbcff7a249a4206cacd36cf9e65ffee7
MD5 d3069e0fc8fd6e43b1cce307d4c25fef
BLAKE2b-256 8164ad09580c748be4690df5cd4bad6444816bc504197dd90c63b24ba023687f

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