Skip to main content

Numista API wrapper

Project description

numistalib

Documentation Status PyPI Release

Python wrapper for the Numista API with caching, rate limiting, and retry logic.

📖 Documentation

Read the Docs — Complete documentation with search, versioning, and offline formats.

Quick Links:

Features

  • Complete API Coverage: Search types, get details, catalogues, issuers, and more
  • HTTP Caching: RFC 9111-compliant persistent caching with hishel
  • Rate Limiting: Configurable rate limits to respect API quotas
  • Retry Logic: Exponential backoff with jitter for resilient requests
  • Rich CLI: Beautiful command-line interface with tables and colors
  • Type Safety: Full Pydantic models with strict validation

Installation

uv pip install -e .

Configuration

  1. Get your API key from Numista API

  2. Copy .env.example to .env:

    cp .env.example .env
    
  3. Add your API key to .env:

    NUMISTA_API_KEY=your_api_key_here
    

CLI Usage

Search for types

numistalib types search -q "dollar"
numistalib types search --issuer united-states --year 2020

Get type details

numistalib types get 95420

List catalogues

numistalib catalogues

List issuers

numistalib issuers
numistalib issuers --lang es

Configuration management

numistalib config list
numistalib config get cache_dir

Python Usage

from numistalib.client import NumistaApiClient
from numistalib.config import Settings, logger
from numistalib.services import TypeService

settings = Settings()

with NumistaApiClient(settings, logger) as client:
    service = TypeService(client, logger)
    
    # Search for types
    results = service.search_types(query="dollar", page=1, count=10)
    for coin_type in results:
        print(f"{coin_type.numista_id}: {coin_type.title}")
    
    # Get full details
    full_type = service.get_type(95420)
    print(f"Weight: {full_type.weight}g")
    print(f"Composition: {full_type.composition}")

Development

Install dependencies

uv sync

Run tests

uv run pytest tests/ -v

Check code quality

uv run ruff check src/
uv run ruff format src/
uv run pyright src/

Check complexity

uv run radon cc src/numistalib/ -a -nb
uv run xenon --max-absolute B src/numistalib/

Architecture

  • models/: Pydantic models for API entities
  • client.py: HTTP client with caching, rate limiting, retry
  • services/: Business logic for each API endpoint
  • config.py: Settings management with Pydantic BaseSettings
  • cli/: Click-based command-line interface

License

MIT License - see license.txt

Contributing

Legal & Attribution

  • Unofficial: This library is an independent, community project and is not affiliated with Numista.
  • Attribution: Numista is a trademark/service of Numista. Please attribute Numista when data from their API is displayed.
  • Terms: Users of this library must comply with Numista’s published terms. Review:
  • Data usage: Follow Numista’s guidelines for caching, rate limits, and redistribution. If Numista’s terms restrict retention or republication (especially for pricing), configure your deployments accordingly.
  • Rate limiting: This project implements conservative rate limiting by default; always respect Numista’s limits and guidance.

See AGENTS.md for coding standards and guidelines.

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

numistalib-0.1.1.tar.gz (161.7 kB view details)

Uploaded Source

Built Distribution

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

numistalib-0.1.1-py3-none-any.whl (89.0 kB view details)

Uploaded Python 3

File details

Details for the file numistalib-0.1.1.tar.gz.

File metadata

  • Download URL: numistalib-0.1.1.tar.gz
  • Upload date:
  • Size: 161.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for numistalib-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0905d31df236a2b016ab1e8b554abd843e65a693ae411e0b6d857b3ad066d1c0
MD5 cf196f8d907ce1d0a9d00a56733855ff
BLAKE2b-256 3b0ffe2f18c0fe16588818b747cc78fba9b6b96d5b84dfd7a4a6a8a754528385

See more details on using hashes here.

Provenance

The following attestation bundles were made for numistalib-0.1.1.tar.gz:

Publisher: release.yml on wells01440/numistalib

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

File details

Details for the file numistalib-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: numistalib-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 89.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for numistalib-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3c93637acf414514318e88b55762e98ecca5f33c0cf9bfce57603ea2fde7c1f2
MD5 79de3447b6192394097e1675fbcab132
BLAKE2b-256 5ddad4246dff74e14300b6a95ed48c94a0166288063d9f239d6336a678fdd991

See more details on using hashes here.

Provenance

The following attestation bundles were made for numistalib-0.1.1-py3-none-any.whl:

Publisher: release.yml on wells01440/numistalib

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