AstroWay/api v2.204.0 · tr
tüm sistemler normal

Natal Chart API in Python: 3 Examples with the AstroWay SDK

How to compute a natal chart in Python via API - install, first request, transits and synastry - with working code and how it compares to pyswisseph and kerykeion.

If you’re building astrology features in Python, you have two paths: bundle an ephemeris library and do the math locally, or call an API that already does it. This post takes the API route with AstroWay - pip install, a first natal chart, then transits and synastry - and shows where each approach makes sense.

Terminal window
pip install astroway
# or: uv add astroway / poetry add astroway

Grab a key at the dashboard - 10,000 credits/month free, no card. A full natal chart costs 20 credits, so the free tier covers roughly 500 charts a month.

The SDK exposes typed namespaces generated from the OpenAPI spec. chart.compute takes a BirthData model (or a plain dict) and returns the unwrapped result - no { ok, data } envelope to peel:

from astroway import Astroway, BirthData
aw = Astroway(api_key="aw_live_...")
chart = aw.chart.compute(BirthData(
date="1990-07-14",
time="14:30:00",
timezone_offset=3,
latitude=50.45,
longitude=30.52,
))
for planet in chart.planets:
print(f"{planet.name:10} {planet.longitude:.2f}° in {planet.sign}")

The API does not geocode - pass the latitude/longitude and the UTC offset for the birth moment yourself (a one-line lookup with geopy + timezonefinder if you only have a city name).

2. Transits for “what’s happening now”

Section titled “2. Transits for “what’s happening now””

Transit-based features (daily insights, “Saturn is squaring your Sun”) need a second date. transits.compute takes the birth data plus a target_date:

from astroway import TransitsRequest
transits = aw.transits.compute(TransitsRequest(
date="1990-07-14", time="14:30:00", timezone_offset=3,
latitude=50.45, longitude=30.52,
target_date="2027-01-01",
))
for hit in transits.aspects:
print(f"{hit.transiting} {hit.aspect} natal {hit.natal} (orb {hit.orb:.1f}°)")

This is the real difference between a calculation API and a “horoscope text” API: you get the actual aspects, not a paragraph generated by an LLM.

synastry.compute takes two charts and returns the inter-aspect grid plus a compatibility score:

from astroway import SynastryRequest
result = aw.synastry.compute(SynastryRequest(
chart1=BirthData(date="1990-07-14", time="14:30:00", timezone_offset=3, latitude=50.45, longitude=30.52),
chart2=BirthData(date="1992-03-22", time="09:15:00", timezone_offset=2, latitude=48.85, longitude=2.35),
))
print(f"Compatibility: {result.score}/100")

The async client has the same surface. Retries on 429/5xx with exponential backoff are built in, and errors are a typed hierarchy:

import asyncio
from astroway import AsyncAstroway
from astroway import RateLimitError, BadRequestError
async def main():
async with AsyncAstroway(api_key="aw_live_...") as aw:
try:
chart = await aw.chart.compute({
"date": "1990-07-14", "time": "14:30:00",
"timezoneOffset": 3, "latitude": 50.45, "longitude": 30.52,
})
except RateLimitError:
... # back off and retry later
except BadRequestError as e:
print(e) # which field failed validation
asyncio.run(main())

(Note: the BirthData model uses timezone_offset; a raw dict uses the JSON field name timezoneOffset. Both work.)

  • pyswisseph: Python bindings for the Swiss Ephemeris C library. Maximum control, but you compile a C extension, ship the ephemeris data files, and implement house systems, aspects and chart logic yourself.
  • kerykeion: a higher-level library on top of pyswisseph. Less boilerplate, but still a local dependency you install, version and deploy.
  • AstroWay: the same Swiss Ephemeris engine, run on our servers and reached over HTTP. Nothing to compile or ship; you trade a network round-trip for zero install and 761 endpoints beyond the natal chart (synastry, transits, Vedic, Human Design, AI interpretations).

Rule of thumb: a CLI tool or a notebook that runs offline → a local library. A web app, a serverless function, or anything where you don’t want to manage ephemeris files and house-system code → the API.

MakSeong · AstroWay

I build the AstroWay API: Swiss Ephemeris on a clean REST surface, and I write about the dull parts that turn out to matter.

// bunu kullanarak inşa et

Solar Fire'daki aynı Swiss Ephemeris - 4 satır kodla.

Kart gerekmeden ücretsiz anahtar. İlk ödemeye kadar ayda 5.000 istek.

Daha fazla blog yazısı tüm yazılar →

Ephemeris 2026-07-19

Bakım altındaki doğruluk nasıl kontrol edilir: CI karşı swetest ve NASA

Astro-API'de doğruluk kolayca bir ephemeris refactorundan düşebilir. Bu koruma hakkında: bir Swiss Ephemeris çekirdeği uygulama ve API için, yüzlerce dondurulmuş snapshot için standart haritalar ve her PR karşı swetest CGI, Kerykeion, Prokerala ve NASA karanlık listesi.

Engineering 2026-07-15

Üç resmi SDK: TypeScript, Python, PHP ham curl yerine

Ham HTTP çalışır, ancak tiplenmiş istemci saatler tasarruf ettirir: yol otomatik tamamlaması, istek ve yanıt tipleri, 408/409/429/5xx için yerleşik retry ve Stainless tarzı hata hiyerarşisi. Üç resmi SDK'yı inceliyoruz - @astroway/sdk (npm), astroway (PyPI), astroway/sdk (Packagist) - ve bunların tek bir OpenAPI sözleşmesinden nasıl üretildiğini.

Industry 2026-06-05

Free Astrology API: Which One Has the Best Free Tier in 2026?

A side-by-side of free tiers across the major astrology APIs - credits, request caps, card requirements - and how much you can actually build for free.