Skip to main content

salestax-python

PyPI Python versions CI License: MIT

Official Python SDK for the Sales Tax Calculator API — real-time sales tax for 70+ countries, 51 US jurisdictions, and 13 Canadian provinces. Batch up to 100 transactions. Zero runtime dependencies (sync). Full type hints.

Install

pip install salestax-python

Async support:

pip install salestax-python[async]

Quickstart

from salestax import SalesTaxClient

with SalesTaxClient() as client:  # reads SALESTAX_API_KEY
    tax = client.tax.calculate(zip_code="90210", amount=100)

print(tax["taxAmount"])   # 9.75
print(tax["totalAmount"]) # 109.75

Get your API key → salestaxcalculatorapi.com

Features

  • Zero runtime dependencies for the sync client — stdlib urllib only.
  • Optional async client via httpx (pip install salestax-python[async]).
  • Automatic retries with exponential backoff + jitter, honors Retry-After.
  • Typed errors — RateLimitError, ValidationError, TimeoutError, and more. No string parsing. Every error carries code, request_id, and (where applicable) param.
  • Lifecycle hooks — on_request, on_response, on_retry for logging and telemetry.
  • Batch chunking — calculate_batch_chunked() splits >100 automatically.
  • Fully typed — ships py.typed, mypy --strict clean.

Async

import asyncio
from salestax import AsyncSalesTaxClient

async def main():
    async with AsyncSalesTaxClient() as client:
        tax = await client.tax.calculate(zip_code="90210", amount=100)
        print(tax["taxAmount"])

asyncio.run(main())

Batch

with SalesTaxClient() as client:
    result = client.tax.calculate_batch_chunked(
        transactions,           # any length
        idempotency_key="order-12345",
    )

Error Handling

from salestax import RateLimitError, ValidationError

try:
    client.tax.calculate(zip_code="90210", amount=100)
except RateLimitError as err:
    # err.retry_after_ms — back off
    ...
except ValidationError as err:
    # err.param — which field failed
    ...

Configuration

from salestax import SalesTaxClient, RetryPolicy

client = SalesTaxClient(
    api_key="sk_live_...",
    timeout_ms=20_000,
    chunk_batch=True,
    retry=RetryPolicy(max_retries=4),
)

Hooks

client = SalesTaxClient(hooks={
    "on_retry": lambda info: print(f"retry {info['attempt']} in {info['delay_ms']}ms"),
})

Also Available For

Documentation

Full API reference → salestaxcalculatorapi.com/docs

License

MIT © InstaBlick USA

Metadata

Release files for salestax-python 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for salestax-python 0.1.0
File Size Uploaded
salestax_python-0.1.0.tar.gz 21.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for salestax-python 0.1.0
File Interpreter ABI Platform
salestax_python-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 41.8 kB

Release files / salestax_python-0.1.0.tar.gz

Download URL salestax_python-0.1.0.tar.gz
Size 21.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a36fd9b346ce976c0dab4fa0d9f619d81c6f0fa0e9c0de5ac9ca2e6c0fee3a16
BLAKE2b-256 checksum
How to use checksums
f14ecbc6429f16aaf6ba199ba4e1b8c9398284fc1b07445aa388410ac797f4b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release files / salestax_python-0.1.0-py3-none-any.whl

Download URL salestax_python-0.1.0-py3-none-any.whl
Size 20.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
568f93eadba0436b430f48c7e9d06105c51af4991c8a3ce4fe0611bef1d6aabf
BLAKE2b-256 checksum
How to use checksums
0112726b1946f1ebb7f23ec98ae1e6b9d687acf0c2147a28a4ec771d3aac4473
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.0

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page