Skip to main content

tathaastu — Python SDK

Hindu calendar intelligence: panchang, festivals and muhurat, with the derivation behind every answer.

Generated from the OpenAPI 3.1 document that serves the API, so the client cannot drift from the endpoints it wraps.

Install

Not yet published to PyPI. Install from source:

pip install -e packages/python-sdk

First call, no signup

The /v1/demo/ endpoints are public. This runs the moment the package is installed, so you can see the shape of the data before deciding anything:

from tathaastu import TathaAstu

day = TathaAstu().demo.panchang_get(date="2026-11-08")
print(day["tithi"]["name"])           # Chaturdashi (14th)

Quickstart

Everything else needs a key. Demo responses are limited to a fixed location and a narrow date window; the keyed endpoints are the real surface.

from tathaastu import TathaAstu

client = TathaAstu()                      # reads TATHAASTU_API_KEY

day = client.panchang.get(date="2026-11-08", location_id=1)
print(day["tithi"]["name"], day["tithi"]["period"])

for f in client.festivals.list(date="2026-11-08", location_id=1)["festivals"]:
    print(f["festival_key"], f["confidence"], f["confidence_label"])

Ask why

The reason this SDK exists. Every festival carries the rule that produced it:

why = client.festivals.explain(date="2026-11-08", festival="FESTIVAL_DIWALI")
print(why["human_readable"])

Errors

Status codes map to distinct exceptions, because the fixes differ:

Exception Status What to do
AuthenticationError 401 Check TATHAASTU_API_KEY
PlanError 402 The request was valid; your plan excludes this endpoint. Upgrade.
ValidationError 400, 422 .fields names the offending parameters
RateLimitError 429 .retry_after when the server supplies it
NotFoundError 404 No data for that input
ServerError 5xx Retried automatically

PlanError is deliberately not a subclass of AuthenticationError. A 402 is not an auth problem, and treating it as one sends you looking at the wrong thing.

from tathaastu import PlanError, RateLimitError

try:
    client.timings.hora_get(date="2026-11-08", lat=28.6139, lon=77.2090)
except PlanError:
    ...          # upgrade required
except RateLimitError as e:
    time.sleep(e.retry_after or 60)

Retries

Idempotent failures — connection errors, 5xx and 429 — are retried with exponential backoff and full jitter. A 4xx is never retried: repeating it cannot change the answer and only spends quota.

from tathaastu import RetryPolicy, TathaAstu

client = TathaAstu(retry=RetryPolicy(attempts=5, max_backoff=20))

Rate limits

client.panchang.get(date="2026-11-08")
print(client.rate_limit)      # {'limit': 1000, 'remaining': 998}

Empty when the API sends no rate-limit headers — the SDK reports what the server said, never an estimate.

Sweeping a range

for d in client.iter_dates("2026-11-01", "2026-11-30"):
    ...

For anything wide prefer client.panchang.get_range(...) or client.bulk.* — one request rather than N.

Namespaces

panchang · festivals · muhurat · calendar · timings · astronomy · eclipses · calculators · conditions · events · astrology · locations · i18n · bulk · aggregated · shastric · world_festivals · system · demo

Development

python generate_client.py --spec ../openapi.json   # regenerate endpoint methods
python -m pytest tests/ -q

_endpoints.py is generated. Edit generate_client.py, not the output.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tathaastu-0.1.0.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

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

tathaastu-0.1.0-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tathaastu-0.1.0.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.4

File hashes

Hashes for tathaastu-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d39c0f5162a27f07c91111d5219af48f8cf866664be6b5cd1cf25b85c37cf6c0
MD5 998ca20961da6958a9e3304dfc8cba89
BLAKE2b-256 0009bd98c402e5cdfd87c88b62249b7c4c6e181dc4981043dee42c91b38285e1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tathaastu-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.4

File hashes

Hashes for tathaastu-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 283bcb83ffd142b07fa58b4f14a8a03649b4cfb767f252cd001a044d041b6fb0
MD5 877951e9c728380e1eef45fbba9cc486
BLAKE2b-256 b5ed99739f5ac09a77d3b6bbaa70c442e4016c9baaba26df83761d34b8b1cd6e

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