Official Python SDK for the AstroWay API — natal, synastry, transits, Vedic, Human Design, Tarot, Numerology, AI horoscopes. Type-safe, retry-aware, OpenAPI 3.1 generated.
Project description
astroway
Official Python SDK for the AstroWay API — natal charts, synastry, transits, Vedic dashas, Tarot, Numerology, Human Design, AI horoscopes. Sync + async, type-hinted, retry-aware.
700+ endpoints. Synchronous and asynchronous clients with the same surface. Built-in retry on 408/409/429/5xx with exponential backoff. Stainless-style error hierarchy (AuthenticationError / RateLimitError / BadRequestError / …). Just httpx + pydantic under the hood.
Install
pip install astroway
# or with uv
uv add astroway
# or with poetry
poetry add astroway
Get an API key at https://api.astroway.info/dashboard/sign-up — 10 000 credits/month free, no card required. Each endpoint costs 5–500 credits depending on what it computes (pricing).
Requires Python 3.9+.
Quick start
Synchronous
from astroway import Astroway
aw = Astroway(api_key="aw_live_...")
chart = aw.post("/chart", body={
"date": "1990-07-14",
"time": "14:30:00",
"timezoneOffset": 3,
"latitude": 50.45,
"longitude": 30.52,
"houseSystem": "P",
})
asc = chart["angles"]["asc"]
print(f"ASC: {asc['sign']} {asc['degree']:.2f}°")
Asynchronous
import asyncio
from astroway import AsyncAstroway
async def main() -> None:
async with AsyncAstroway(api_key="aw_live_...") as aw:
chart = await aw.post("/chart", body={
"date": "1990-07-14",
"time": "14:30:00",
"timezoneOffset": 3,
"latitude": 50.45,
"longitude": 30.52,
})
print(chart["angles"]["asc"])
asyncio.run(main())
The two clients share an identical surface — same constructor params, same methods (get, post, put, delete, low-level request), same error types.
Common workflows
Synastry
result = aw.post("/synastry", body={
"chart1": {"date": "1990-07-14", "time": "14:30:00", "timezoneOffset": 3, "latitude": 50.45, "longitude": 30.52},
"chart2": {"date": "1992-03-22", "time": "09:15:00", "timezoneOffset": 2, "latitude": 48.85, "longitude": 2.35},
})
print(f"Score: {result['compatibility']['score']}/100 ({result['compatibility']['label']})")
Transits to natal
transits = aw.post("/transits", body={
"date": "1990-07-14", "time": "14:30:00", "timezoneOffset": 3, "latitude": 50.45, "longitude": 30.52,
"targetDate": "2027-01-01",
})
Vedic Vimshottari Mahadasha
dasha = aw.post("/vedic/dashas/vimshottari/maha", body={
"date": "1985-07-22", "time": "06:45:00", "timezoneOffset": 5.5,
"latitude": 19.07, "longitude": 72.87,
})
Tarot reading
spread = aw.post("/tarot/rider-waite/spread", body={"spreadType": "three-card", "seed": 42})
Human Design
hd = aw.post("/human-design", body={
"date": "1990-07-14", "time": "14:30:00", "timezoneOffset": 3, "latitude": 50.45, "longitude": 30.52,
})
print(f"{hd['type']} — {hd['strategy']} — {hd['authority']}")
Error handling
The SDK raises typed subclasses of ApiError. Catch order matters — most specific first:
from astroway import (
Astroway, ApiError,
AuthenticationError, RateLimitError, BadRequestError,
)
try:
aw.post("/chart", body=body)
except RateLimitError as e:
time.sleep(e.retry_after_seconds or 60)
# retry once...
except AuthenticationError:
raise RuntimeError("Rotate your AstroWay API key")
except BadRequestError as e:
print("Validation failed:", e.body)
except ApiError as e:
print(f"API error {e.status} ({e.code}): {e!s} [request_id={e.request_id}]")
Full hierarchy:
ApiError(base)APIConnectionErrorAPITimeoutError
BadRequestError(400)AuthenticationError(401)PermissionDeniedError(403)NotFoundError(404)UnprocessableEntityError(422)RateLimitError(429) — carriesretry_after_secondsInternalServerError(5xx)
Configuration
aw = Astroway(
api_key="aw_live_...", # required
base_url="https://api.astroway.info/v1", # override for staging / self-hosted
auth_scheme="header", # "header" (X-Api-Key, default) or "bearer" (Authorization: Bearer)
timeout=30.0, # per-request timeout in seconds
retry={
"max_retries": 2, # total attempts = 1 + max_retries
"base_delay_ms": 250,
"max_delay_ms": 30_000,
"retryable_statuses": frozenset({408, 409, 429, 500, 502, 503, 504}),
},
default_headers={"X-Trace-Id": "..."},
)
The default retry honors Retry-After (seconds or HTTP-date) on 429 responses.
Set retry={"max_retries": 0} to disable retries entirely.
Authentication
Two equivalent auth schemes — pick whichever your stack prefers:
- Header (default):
X-Api-Key: aw_live_...— same convention ascurl/Postman examples. - Bearer:
Authorization: Bearer aw_live_...— same convention as Stripe/OpenAI/Anthropic SDKs.
Set via auth_scheme="bearer" in the constructor.
Privacy
The SDK does not phone home. There is no telemetry, no analytics, no usage reporting. The only network traffic the SDK originates is the AstroWay API calls you ask it to make.
Outgoing requests carry two identifying headers so the AstroWay backend can distinguish SDK traffic from raw HTTP traffic in its own logs:
User-Agent: astroway-sdk-python/<version> (Python/<py-version>; <platform>)X-Astroway-Channel: sdk-py
Neither carries a session ID, machine fingerprint, or anything personal.
Stability
- Public API stable inside a major version. Methods/classes shipped under
1.xwon't be renamed or removed without a deprecation note inCHANGELOG.mdand a one-minor parallel-availability window. - Body shape stable inside a minor version. Tightening (constraints, enum) ships in patches; new required keys require a minor bump.
- API version vs SDK version are independent. SDK
0.xfollows its own semver; the API itself sits at/v1/.
Links
- 📦 PyPI: https://pypi.org/project/astroway/
- 📘 API docs: https://api.astroway.info/docs/api/
- 🔑 Sign up & dashboard: https://api.astroway.info/dashboard/
- 💰 Pricing: https://api.astroway.info/pricing/
- 🟦 TypeScript SDK:
@astroway/sdk - 🤖 MCP server:
@astroway/mcp - 🌐 Website: https://astroway.info
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file astroway-0.1.0a1.tar.gz.
File metadata
- Download URL: astroway-0.1.0a1.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4ccb2fde92e1869893a4dedfd8b3983627846f82dde661a46831d0ab56cd249
|
|
| MD5 |
1d65402c81a1ece059f5c12c874a0905
|
|
| BLAKE2b-256 |
b1a02c56f3c0def8c6975e0f5ccce67d421885cdeda0a76e2b917457b57c4ec4
|
Provenance
The following attestation bundles were made for astroway-0.1.0a1.tar.gz:
Publisher:
release.yml on astroway/astroway-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
astroway-0.1.0a1.tar.gz -
Subject digest:
c4ccb2fde92e1869893a4dedfd8b3983627846f82dde661a46831d0ab56cd249 - Sigstore transparency entry: 1487750096
- Sigstore integration time:
-
Permalink:
astroway/astroway-python@b0d9fc687c42a4371ee906559319973e05887bcd -
Branch / Tag:
refs/tags/v0.1.0a1 - Owner: https://github.com/astroway
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b0d9fc687c42a4371ee906559319973e05887bcd -
Trigger Event:
push
-
Statement type:
File details
Details for the file astroway-0.1.0a1-py3-none-any.whl.
File metadata
- Download URL: astroway-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d32a64bbf9735b53bc433e3bc5fca94f6b3031d87e09314769f2c800ee452498
|
|
| MD5 |
92b8c3f0b690c484d21cbaf40efe83e3
|
|
| BLAKE2b-256 |
7abd5db309ed11021f485e99c43bc4e97b64e8caae07326121789d0c9fb2c3dd
|
Provenance
The following attestation bundles were made for astroway-0.1.0a1-py3-none-any.whl:
Publisher:
release.yml on astroway/astroway-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
astroway-0.1.0a1-py3-none-any.whl -
Subject digest:
d32a64bbf9735b53bc433e3bc5fca94f6b3031d87e09314769f2c800ee452498 - Sigstore transparency entry: 1487750138
- Sigstore integration time:
-
Permalink:
astroway/astroway-python@b0d9fc687c42a4371ee906559319973e05887bcd -
Branch / Tag:
refs/tags/v0.1.0a1 - Owner: https://github.com/astroway
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b0d9fc687c42a4371ee906559319973e05887bcd -
Trigger Event:
push
-
Statement type: