lifeastroapi 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lifeastroapi/__init__.py +68 -0
- lifeastroapi/_client.py +227 -0
- lifeastroapi/_core.py +28 -0
- lifeastroapi/_http.py +282 -0
- lifeastroapi/_params.py +89 -0
- lifeastroapi/_version.py +3 -0
- lifeastroapi/errors.py +152 -0
- lifeastroapi/py.typed +0 -0
- lifeastroapi/resources/__init__.py +188 -0
- lifeastroapi/resources/ashtakavarga.py +279 -0
- lifeastroapi/resources/calendar.py +281 -0
- lifeastroapi/resources/chart.py +1781 -0
- lifeastroapi/resources/dasha.py +1009 -0
- lifeastroapi/resources/eclipses.py +215 -0
- lifeastroapi/resources/festivals.py +245 -0
- lifeastroapi/resources/geo.py +177 -0
- lifeastroapi/resources/horoscope.py +155 -0
- lifeastroapi/resources/lalkitab.py +219 -0
- lifeastroapi/resources/meta.py +239 -0
- lifeastroapi/resources/milan.py +969 -0
- lifeastroapi/resources/muhurta.py +737 -0
- lifeastroapi/resources/narrative.py +2719 -0
- lifeastroapi/resources/numerology.py +417 -0
- lifeastroapi/resources/panchang.py +1709 -0
- lifeastroapi/resources/planet_moments.py +265 -0
- lifeastroapi/resources/prashna.py +335 -0
- lifeastroapi/resources/remedies.py +579 -0
- lifeastroapi/resources/reports.py +845 -0
- lifeastroapi/resources/tarot.py +207 -0
- lifeastroapi/resources/transit.py +615 -0
- lifeastroapi/resources/varshaphal.py +501 -0
- lifeastroapi/resources/western.py +5569 -0
- lifeastroapi/types.py +128 -0
- lifeastroapi-0.1.0.dist-info/METADATA +465 -0
- lifeastroapi-0.1.0.dist-info/RECORD +37 -0
- lifeastroapi-0.1.0.dist-info/WHEEL +4 -0
- lifeastroapi-0.1.0.dist-info/licenses/LICENSE +21 -0
lifeastroapi/errors.py
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"""Errors raised by the SDK.
|
|
2
|
+
|
|
3
|
+
Every non-2xx response raises a :class:`LifeAstroError` subclass carrying the
|
|
4
|
+
API's ``code``, the HTTP ``status`` and the ``request_id`` (quote it to
|
|
5
|
+
support). Network failures raise :class:`LifeAstroConnectionError`, and
|
|
6
|
+
timeouts its subclass :class:`LifeAstroTimeoutError`.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from typing import Any
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class LifeAstroError(Exception):
|
|
15
|
+
"""Base class of every error raised by the SDK."""
|
|
16
|
+
|
|
17
|
+
message: str
|
|
18
|
+
"""Human-readable message from the API (or the SDK)."""
|
|
19
|
+
code: str
|
|
20
|
+
"""Machine-readable code, e.g. ``insufficient_credits`` or ``timeout``."""
|
|
21
|
+
status: int
|
|
22
|
+
"""HTTP status code; ``0`` when no response was received."""
|
|
23
|
+
request_id: str | None
|
|
24
|
+
"""The API's request id, when present. Quote it to support."""
|
|
25
|
+
body: Any
|
|
26
|
+
"""The parsed response body, when there was one."""
|
|
27
|
+
|
|
28
|
+
def __init__(
|
|
29
|
+
self,
|
|
30
|
+
message: str,
|
|
31
|
+
*,
|
|
32
|
+
code: str,
|
|
33
|
+
status: int,
|
|
34
|
+
request_id: str | None = None,
|
|
35
|
+
body: Any = None,
|
|
36
|
+
) -> None:
|
|
37
|
+
super().__init__(message)
|
|
38
|
+
self.message = message
|
|
39
|
+
self.code = code
|
|
40
|
+
self.status = status
|
|
41
|
+
self.request_id = request_id
|
|
42
|
+
self.body = body
|
|
43
|
+
|
|
44
|
+
def __str__(self) -> str:
|
|
45
|
+
details = [f"code={self.code}"]
|
|
46
|
+
if self.status:
|
|
47
|
+
details.insert(0, f"HTTP {self.status}")
|
|
48
|
+
if self.request_id:
|
|
49
|
+
details.append(f"request_id={self.request_id}")
|
|
50
|
+
return f"{self.message} ({', '.join(details)})"
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class BadRequestError(LifeAstroError):
|
|
54
|
+
"""400: a query parameter was missing, malformed or out of range."""
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class AuthenticationError(LifeAstroError):
|
|
58
|
+
"""401: missing or invalid API key."""
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class PaymentRequiredError(LifeAstroError):
|
|
62
|
+
"""402: out of credits, trial used up, or payment required."""
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class PermissionDeniedError(LifeAstroError):
|
|
66
|
+
"""403: the key is valid but not allowed (plan, IP allow-list, suspended account)."""
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class NotFoundError(LifeAstroError):
|
|
70
|
+
"""404: unknown path or sub-resource (for example an unknown yoga id)."""
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class RateLimitError(LifeAstroError):
|
|
74
|
+
"""429: rate limit or daily quota reached."""
|
|
75
|
+
|
|
76
|
+
retry_after: float | None
|
|
77
|
+
"""Seconds to wait before retrying, from the ``Retry-After`` header."""
|
|
78
|
+
|
|
79
|
+
def __init__(
|
|
80
|
+
self,
|
|
81
|
+
message: str,
|
|
82
|
+
*,
|
|
83
|
+
code: str,
|
|
84
|
+
status: int,
|
|
85
|
+
request_id: str | None = None,
|
|
86
|
+
body: Any = None,
|
|
87
|
+
retry_after: float | None = None,
|
|
88
|
+
) -> None:
|
|
89
|
+
super().__init__(message, code=code, status=status, request_id=request_id, body=body)
|
|
90
|
+
self.retry_after = retry_after
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class ServerError(LifeAstroError):
|
|
94
|
+
"""5xx: the API failed to answer."""
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class LifeAstroConnectionError(LifeAstroError):
|
|
98
|
+
"""The request did not get a response: DNS, connection or network failure."""
|
|
99
|
+
|
|
100
|
+
def __init__(self, message: str, *, code: str = "connection_error") -> None:
|
|
101
|
+
super().__init__(message, code=code, status=0)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class LifeAstroTimeoutError(LifeAstroConnectionError):
|
|
105
|
+
"""The request timed out (``code == "timeout"``)."""
|
|
106
|
+
|
|
107
|
+
def __init__(self, message: str) -> None:
|
|
108
|
+
super().__init__(message, code="timeout")
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def _status_code_name(status: int) -> str:
|
|
112
|
+
if status >= 500:
|
|
113
|
+
return "internal_error"
|
|
114
|
+
if status >= 400:
|
|
115
|
+
return "bad_request"
|
|
116
|
+
return "error"
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def error_from_response(status: int, body: Any, retry_after: float | None = None) -> LifeAstroError:
|
|
120
|
+
"""Build the error subclass for an HTTP status and parsed body.
|
|
121
|
+
|
|
122
|
+
The API's error body is ``{"error": {"code", "message", "request_id"}}``.
|
|
123
|
+
"""
|
|
124
|
+
parsed = body.get("error") if isinstance(body, dict) else None
|
|
125
|
+
if not isinstance(parsed, dict):
|
|
126
|
+
parsed = {}
|
|
127
|
+
code = parsed.get("code")
|
|
128
|
+
message = parsed.get("message")
|
|
129
|
+
request_id = parsed.get("request_id")
|
|
130
|
+
kwargs: dict[str, Any] = {
|
|
131
|
+
"code": code if isinstance(code, str) and code else _status_code_name(status),
|
|
132
|
+
"status": status,
|
|
133
|
+
"request_id": request_id if isinstance(request_id, str) else None,
|
|
134
|
+
"body": body,
|
|
135
|
+
}
|
|
136
|
+
text = message if isinstance(message, str) and message else f"HTTP {status}"
|
|
137
|
+
|
|
138
|
+
if status == 400:
|
|
139
|
+
return BadRequestError(text, **kwargs)
|
|
140
|
+
if status == 401:
|
|
141
|
+
return AuthenticationError(text, **kwargs)
|
|
142
|
+
if status == 402:
|
|
143
|
+
return PaymentRequiredError(text, **kwargs)
|
|
144
|
+
if status == 403:
|
|
145
|
+
return PermissionDeniedError(text, **kwargs)
|
|
146
|
+
if status == 404:
|
|
147
|
+
return NotFoundError(text, **kwargs)
|
|
148
|
+
if status == 429:
|
|
149
|
+
return RateLimitError(text, retry_after=retry_after, **kwargs)
|
|
150
|
+
if status >= 500:
|
|
151
|
+
return ServerError(text, **kwargs)
|
|
152
|
+
return LifeAstroError(text, **kwargs)
|
lifeastroapi/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# GENERATED by scripts/generate.py from the endpoint manifest. Do not edit by hand.
|
|
2
|
+
# Run `python scripts/generate.py` to regenerate.
|
|
3
|
+
"""Every resource group of the API, as attributes of the client."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from .._core import AsyncCore, SyncCore
|
|
8
|
+
from .ashtakavarga import Ashtakavarga, AsyncAshtakavarga
|
|
9
|
+
from .calendar import AsyncCalendar, Calendar
|
|
10
|
+
from .chart import AsyncChart, Chart
|
|
11
|
+
from .dasha import AsyncDasha, Dasha
|
|
12
|
+
from .eclipses import AsyncEclipses, Eclipses
|
|
13
|
+
from .festivals import AsyncFestivals, Festivals
|
|
14
|
+
from .geo import AsyncGeo, Geo
|
|
15
|
+
from .horoscope import AsyncHoroscope, Horoscope
|
|
16
|
+
from .lalkitab import AsyncLalkitab, Lalkitab
|
|
17
|
+
from .meta import AsyncMeta, Meta
|
|
18
|
+
from .milan import AsyncMilan, Milan
|
|
19
|
+
from .muhurta import AsyncMuhurta, Muhurta
|
|
20
|
+
from .narrative import AsyncNarrative, Narrative
|
|
21
|
+
from .numerology import AsyncNumerology, Numerology
|
|
22
|
+
from .panchang import AsyncPanchang, Panchang
|
|
23
|
+
from .planet_moments import AsyncPlanetMoments, PlanetMoments
|
|
24
|
+
from .prashna import AsyncPrashna, Prashna
|
|
25
|
+
from .remedies import AsyncRemedies, Remedies
|
|
26
|
+
from .reports import AsyncReports, Reports
|
|
27
|
+
from .tarot import AsyncTarot, Tarot
|
|
28
|
+
from .transit import AsyncTransit, Transit
|
|
29
|
+
from .varshaphal import AsyncVarshaphal, Varshaphal
|
|
30
|
+
from .western import AsyncWestern, Western
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class Resources:
|
|
34
|
+
"""The resource groups of :class:`LifeAstro`: ``client.panchang`` and so on."""
|
|
35
|
+
|
|
36
|
+
ashtakavarga: Ashtakavarga
|
|
37
|
+
calendar: Calendar
|
|
38
|
+
chart: Chart
|
|
39
|
+
dasha: Dasha
|
|
40
|
+
eclipses: Eclipses
|
|
41
|
+
festivals: Festivals
|
|
42
|
+
geo: Geo
|
|
43
|
+
horoscope: Horoscope
|
|
44
|
+
lalkitab: Lalkitab
|
|
45
|
+
meta: Meta
|
|
46
|
+
milan: Milan
|
|
47
|
+
muhurta: Muhurta
|
|
48
|
+
narrative: Narrative
|
|
49
|
+
numerology: Numerology
|
|
50
|
+
panchang: Panchang
|
|
51
|
+
planet_moments: PlanetMoments
|
|
52
|
+
prashna: Prashna
|
|
53
|
+
remedies: Remedies
|
|
54
|
+
reports: Reports
|
|
55
|
+
tarot: Tarot
|
|
56
|
+
transit: Transit
|
|
57
|
+
varshaphal: Varshaphal
|
|
58
|
+
western: Western
|
|
59
|
+
|
|
60
|
+
def __init__(self, client: SyncCore) -> None:
|
|
61
|
+
self.ashtakavarga = Ashtakavarga(client)
|
|
62
|
+
self.calendar = Calendar(client)
|
|
63
|
+
self.chart = Chart(client)
|
|
64
|
+
self.dasha = Dasha(client)
|
|
65
|
+
self.eclipses = Eclipses(client)
|
|
66
|
+
self.festivals = Festivals(client)
|
|
67
|
+
self.geo = Geo(client)
|
|
68
|
+
self.horoscope = Horoscope(client)
|
|
69
|
+
self.lalkitab = Lalkitab(client)
|
|
70
|
+
self.meta = Meta(client)
|
|
71
|
+
self.milan = Milan(client)
|
|
72
|
+
self.muhurta = Muhurta(client)
|
|
73
|
+
self.narrative = Narrative(client)
|
|
74
|
+
self.numerology = Numerology(client)
|
|
75
|
+
self.panchang = Panchang(client)
|
|
76
|
+
self.planet_moments = PlanetMoments(client)
|
|
77
|
+
self.prashna = Prashna(client)
|
|
78
|
+
self.remedies = Remedies(client)
|
|
79
|
+
self.reports = Reports(client)
|
|
80
|
+
self.tarot = Tarot(client)
|
|
81
|
+
self.transit = Transit(client)
|
|
82
|
+
self.varshaphal = Varshaphal(client)
|
|
83
|
+
self.western = Western(client)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class AsyncResources:
|
|
87
|
+
"""The resource groups of :class:`AsyncLifeAstro`."""
|
|
88
|
+
|
|
89
|
+
ashtakavarga: AsyncAshtakavarga
|
|
90
|
+
calendar: AsyncCalendar
|
|
91
|
+
chart: AsyncChart
|
|
92
|
+
dasha: AsyncDasha
|
|
93
|
+
eclipses: AsyncEclipses
|
|
94
|
+
festivals: AsyncFestivals
|
|
95
|
+
geo: AsyncGeo
|
|
96
|
+
horoscope: AsyncHoroscope
|
|
97
|
+
lalkitab: AsyncLalkitab
|
|
98
|
+
meta: AsyncMeta
|
|
99
|
+
milan: AsyncMilan
|
|
100
|
+
muhurta: AsyncMuhurta
|
|
101
|
+
narrative: AsyncNarrative
|
|
102
|
+
numerology: AsyncNumerology
|
|
103
|
+
panchang: AsyncPanchang
|
|
104
|
+
planet_moments: AsyncPlanetMoments
|
|
105
|
+
prashna: AsyncPrashna
|
|
106
|
+
remedies: AsyncRemedies
|
|
107
|
+
reports: AsyncReports
|
|
108
|
+
tarot: AsyncTarot
|
|
109
|
+
transit: AsyncTransit
|
|
110
|
+
varshaphal: AsyncVarshaphal
|
|
111
|
+
western: AsyncWestern
|
|
112
|
+
|
|
113
|
+
def __init__(self, client: AsyncCore) -> None:
|
|
114
|
+
self.ashtakavarga = AsyncAshtakavarga(client)
|
|
115
|
+
self.calendar = AsyncCalendar(client)
|
|
116
|
+
self.chart = AsyncChart(client)
|
|
117
|
+
self.dasha = AsyncDasha(client)
|
|
118
|
+
self.eclipses = AsyncEclipses(client)
|
|
119
|
+
self.festivals = AsyncFestivals(client)
|
|
120
|
+
self.geo = AsyncGeo(client)
|
|
121
|
+
self.horoscope = AsyncHoroscope(client)
|
|
122
|
+
self.lalkitab = AsyncLalkitab(client)
|
|
123
|
+
self.meta = AsyncMeta(client)
|
|
124
|
+
self.milan = AsyncMilan(client)
|
|
125
|
+
self.muhurta = AsyncMuhurta(client)
|
|
126
|
+
self.narrative = AsyncNarrative(client)
|
|
127
|
+
self.numerology = AsyncNumerology(client)
|
|
128
|
+
self.panchang = AsyncPanchang(client)
|
|
129
|
+
self.planet_moments = AsyncPlanetMoments(client)
|
|
130
|
+
self.prashna = AsyncPrashna(client)
|
|
131
|
+
self.remedies = AsyncRemedies(client)
|
|
132
|
+
self.reports = AsyncReports(client)
|
|
133
|
+
self.tarot = AsyncTarot(client)
|
|
134
|
+
self.transit = AsyncTransit(client)
|
|
135
|
+
self.varshaphal = AsyncVarshaphal(client)
|
|
136
|
+
self.western = AsyncWestern(client)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
__all__ = [
|
|
140
|
+
"Ashtakavarga",
|
|
141
|
+
"AsyncAshtakavarga",
|
|
142
|
+
"AsyncCalendar",
|
|
143
|
+
"AsyncChart",
|
|
144
|
+
"AsyncDasha",
|
|
145
|
+
"AsyncEclipses",
|
|
146
|
+
"AsyncFestivals",
|
|
147
|
+
"AsyncGeo",
|
|
148
|
+
"AsyncHoroscope",
|
|
149
|
+
"AsyncLalkitab",
|
|
150
|
+
"AsyncMeta",
|
|
151
|
+
"AsyncMilan",
|
|
152
|
+
"AsyncMuhurta",
|
|
153
|
+
"AsyncNarrative",
|
|
154
|
+
"AsyncNumerology",
|
|
155
|
+
"AsyncPanchang",
|
|
156
|
+
"AsyncPlanetMoments",
|
|
157
|
+
"AsyncPrashna",
|
|
158
|
+
"AsyncRemedies",
|
|
159
|
+
"AsyncReports",
|
|
160
|
+
"AsyncResources",
|
|
161
|
+
"AsyncTarot",
|
|
162
|
+
"AsyncTransit",
|
|
163
|
+
"AsyncVarshaphal",
|
|
164
|
+
"AsyncWestern",
|
|
165
|
+
"Calendar",
|
|
166
|
+
"Chart",
|
|
167
|
+
"Dasha",
|
|
168
|
+
"Eclipses",
|
|
169
|
+
"Festivals",
|
|
170
|
+
"Geo",
|
|
171
|
+
"Horoscope",
|
|
172
|
+
"Lalkitab",
|
|
173
|
+
"Meta",
|
|
174
|
+
"Milan",
|
|
175
|
+
"Muhurta",
|
|
176
|
+
"Narrative",
|
|
177
|
+
"Numerology",
|
|
178
|
+
"Panchang",
|
|
179
|
+
"PlanetMoments",
|
|
180
|
+
"Prashna",
|
|
181
|
+
"Remedies",
|
|
182
|
+
"Reports",
|
|
183
|
+
"Resources",
|
|
184
|
+
"Tarot",
|
|
185
|
+
"Transit",
|
|
186
|
+
"Varshaphal",
|
|
187
|
+
"Western",
|
|
188
|
+
]
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
# GENERATED by scripts/generate.py from the endpoint manifest. Do not edit by hand.
|
|
2
|
+
# Run `python scripts/generate.py` to regenerate.
|
|
3
|
+
"""Ashtakavarga: sarva, bhinna (per planet), kaksha and transit score."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from .._core import AsyncCore, SyncCore
|
|
10
|
+
from .._params import build_path, put, put_fields
|
|
11
|
+
from ..types import Ayanamsa, BirthInput, Locale, QueryParams, RequestOptions
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Ashtakavarga:
|
|
15
|
+
"""Ashtakavarga: sarva, bhinna (per planet), kaksha and transit score. Use
|
|
16
|
+
``client.ashtakavarga``.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
def __init__(self, client: SyncCore) -> None:
|
|
20
|
+
self._c = client
|
|
21
|
+
|
|
22
|
+
def bhinna(
|
|
23
|
+
self,
|
|
24
|
+
*,
|
|
25
|
+
planet: str,
|
|
26
|
+
lat: float,
|
|
27
|
+
lon: float,
|
|
28
|
+
date: str,
|
|
29
|
+
time: str,
|
|
30
|
+
tz: str,
|
|
31
|
+
ayanamsa: Ayanamsa | None = None,
|
|
32
|
+
lang: Locale | None = None,
|
|
33
|
+
request_options: RequestOptions | None = None,
|
|
34
|
+
) -> Any:
|
|
35
|
+
"""Bhinnashtakavarga (BAV) for one planet.
|
|
36
|
+
|
|
37
|
+
Cost: 20 credits per call.
|
|
38
|
+
|
|
39
|
+
Wire names: ``lat`` -> ``birth.lat``, ``lon`` -> ``birth.lon``, ``date`` -> ``birth.date``,
|
|
40
|
+
``time`` -> ``birth.time``, ``tz`` -> ``birth.tz``.
|
|
41
|
+
|
|
42
|
+
``GET /v1/ashtakavarga/bhinna/{planet}``
|
|
43
|
+
"""
|
|
44
|
+
_q: QueryParams = {}
|
|
45
|
+
put(_q, "birth.lat", lat)
|
|
46
|
+
put(_q, "birth.lon", lon)
|
|
47
|
+
put(_q, "birth.date", date)
|
|
48
|
+
put(_q, "birth.time", time)
|
|
49
|
+
put(_q, "birth.tz", tz)
|
|
50
|
+
put(_q, "ayanamsa", ayanamsa)
|
|
51
|
+
put(_q, "lang", lang)
|
|
52
|
+
put(_q, "locale", lang)
|
|
53
|
+
return self._c.request(
|
|
54
|
+
build_path("/v1/ashtakavarga/bhinna/{planet}", {"planet": planet}),
|
|
55
|
+
_q,
|
|
56
|
+
request_options=request_options,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
def kaksha(
|
|
60
|
+
self,
|
|
61
|
+
*,
|
|
62
|
+
birth: BirthInput,
|
|
63
|
+
date: str,
|
|
64
|
+
time: str,
|
|
65
|
+
tz: str,
|
|
66
|
+
ayanamsa: Ayanamsa | None = None,
|
|
67
|
+
lang: Locale | None = None,
|
|
68
|
+
request_options: RequestOptions | None = None,
|
|
69
|
+
) -> Any:
|
|
70
|
+
"""Get Kaksha (sub-division) level Ashtakavarga analysis — divides each sign into 8 equal
|
|
71
|
+
3°45′ segments, each ruled by a graha.
|
|
72
|
+
|
|
73
|
+
Cost: 30 credits per call.
|
|
74
|
+
|
|
75
|
+
``GET /v1/ashtakavarga/kaksha``
|
|
76
|
+
"""
|
|
77
|
+
_q: QueryParams = {}
|
|
78
|
+
put_fields(_q, birth, "birth.")
|
|
79
|
+
put(_q, "date", date)
|
|
80
|
+
put(_q, "time", time)
|
|
81
|
+
put(_q, "tz", tz)
|
|
82
|
+
put(_q, "ayanamsa", ayanamsa)
|
|
83
|
+
put(_q, "lang", lang)
|
|
84
|
+
put(_q, "locale", lang)
|
|
85
|
+
return self._c.request("/v1/ashtakavarga/kaksha", _q, request_options=request_options)
|
|
86
|
+
|
|
87
|
+
def sarva(
|
|
88
|
+
self,
|
|
89
|
+
*,
|
|
90
|
+
lat: float,
|
|
91
|
+
lon: float,
|
|
92
|
+
date: str,
|
|
93
|
+
time: str,
|
|
94
|
+
tz: str,
|
|
95
|
+
ayanamsa: Ayanamsa | None = None,
|
|
96
|
+
request_options: RequestOptions | None = None,
|
|
97
|
+
) -> Any:
|
|
98
|
+
"""Get the Sarvashtakavarga table — the combined 12-sign benefic-point grid from all 9
|
|
99
|
+
grahas.
|
|
100
|
+
|
|
101
|
+
Cost: 20 credits per call.
|
|
102
|
+
|
|
103
|
+
Wire names: ``lat`` -> ``birth.lat``, ``lon`` -> ``birth.lon``, ``date`` -> ``birth.date``,
|
|
104
|
+
``time`` -> ``birth.time``, ``tz`` -> ``birth.tz``.
|
|
105
|
+
|
|
106
|
+
``GET /v1/ashtakavarga/sarva``
|
|
107
|
+
"""
|
|
108
|
+
_q: QueryParams = {}
|
|
109
|
+
put(_q, "birth.lat", lat)
|
|
110
|
+
put(_q, "birth.lon", lon)
|
|
111
|
+
put(_q, "birth.date", date)
|
|
112
|
+
put(_q, "birth.time", time)
|
|
113
|
+
put(_q, "birth.tz", tz)
|
|
114
|
+
put(_q, "ayanamsa", ayanamsa)
|
|
115
|
+
return self._c.request("/v1/ashtakavarga/sarva", _q, request_options=request_options)
|
|
116
|
+
|
|
117
|
+
def transit_score(
|
|
118
|
+
self,
|
|
119
|
+
*,
|
|
120
|
+
birth: BirthInput,
|
|
121
|
+
date: str,
|
|
122
|
+
time: str,
|
|
123
|
+
tz: str,
|
|
124
|
+
ayanamsa: Ayanamsa | None = None,
|
|
125
|
+
lang: Locale | None = None,
|
|
126
|
+
request_options: RequestOptions | None = None,
|
|
127
|
+
) -> Any:
|
|
128
|
+
"""Score current (or a given date's) planetary transits against a natal chart using
|
|
129
|
+
Ashtakavarga benefic points.
|
|
130
|
+
|
|
131
|
+
Cost: 20 credits per call.
|
|
132
|
+
|
|
133
|
+
``GET /v1/ashtakavarga/transit-score``
|
|
134
|
+
"""
|
|
135
|
+
_q: QueryParams = {}
|
|
136
|
+
put_fields(_q, birth, "birth.")
|
|
137
|
+
put(_q, "date", date)
|
|
138
|
+
put(_q, "time", time)
|
|
139
|
+
put(_q, "tz", tz)
|
|
140
|
+
put(_q, "ayanamsa", ayanamsa)
|
|
141
|
+
put(_q, "lang", lang)
|
|
142
|
+
put(_q, "locale", lang)
|
|
143
|
+
return self._c.request(
|
|
144
|
+
"/v1/ashtakavarga/transit-score", _q, request_options=request_options
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
class AsyncAshtakavarga:
|
|
149
|
+
"""Ashtakavarga: sarva, bhinna (per planet), kaksha and transit score. Use
|
|
150
|
+
``client.ashtakavarga`` on :class:`AsyncLifeAstro`.
|
|
151
|
+
"""
|
|
152
|
+
|
|
153
|
+
def __init__(self, client: AsyncCore) -> None:
|
|
154
|
+
self._c = client
|
|
155
|
+
|
|
156
|
+
async def bhinna(
|
|
157
|
+
self,
|
|
158
|
+
*,
|
|
159
|
+
planet: str,
|
|
160
|
+
lat: float,
|
|
161
|
+
lon: float,
|
|
162
|
+
date: str,
|
|
163
|
+
time: str,
|
|
164
|
+
tz: str,
|
|
165
|
+
ayanamsa: Ayanamsa | None = None,
|
|
166
|
+
lang: Locale | None = None,
|
|
167
|
+
request_options: RequestOptions | None = None,
|
|
168
|
+
) -> Any:
|
|
169
|
+
"""Bhinnashtakavarga (BAV) for one planet.
|
|
170
|
+
|
|
171
|
+
Cost: 20 credits per call.
|
|
172
|
+
|
|
173
|
+
Wire names: ``lat`` -> ``birth.lat``, ``lon`` -> ``birth.lon``, ``date`` -> ``birth.date``,
|
|
174
|
+
``time`` -> ``birth.time``, ``tz`` -> ``birth.tz``.
|
|
175
|
+
|
|
176
|
+
``GET /v1/ashtakavarga/bhinna/{planet}``
|
|
177
|
+
"""
|
|
178
|
+
_q: QueryParams = {}
|
|
179
|
+
put(_q, "birth.lat", lat)
|
|
180
|
+
put(_q, "birth.lon", lon)
|
|
181
|
+
put(_q, "birth.date", date)
|
|
182
|
+
put(_q, "birth.time", time)
|
|
183
|
+
put(_q, "birth.tz", tz)
|
|
184
|
+
put(_q, "ayanamsa", ayanamsa)
|
|
185
|
+
put(_q, "lang", lang)
|
|
186
|
+
put(_q, "locale", lang)
|
|
187
|
+
return await self._c.request(
|
|
188
|
+
build_path("/v1/ashtakavarga/bhinna/{planet}", {"planet": planet}),
|
|
189
|
+
_q,
|
|
190
|
+
request_options=request_options,
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
async def kaksha(
|
|
194
|
+
self,
|
|
195
|
+
*,
|
|
196
|
+
birth: BirthInput,
|
|
197
|
+
date: str,
|
|
198
|
+
time: str,
|
|
199
|
+
tz: str,
|
|
200
|
+
ayanamsa: Ayanamsa | None = None,
|
|
201
|
+
lang: Locale | None = None,
|
|
202
|
+
request_options: RequestOptions | None = None,
|
|
203
|
+
) -> Any:
|
|
204
|
+
"""Get Kaksha (sub-division) level Ashtakavarga analysis — divides each sign into 8 equal
|
|
205
|
+
3°45′ segments, each ruled by a graha.
|
|
206
|
+
|
|
207
|
+
Cost: 30 credits per call.
|
|
208
|
+
|
|
209
|
+
``GET /v1/ashtakavarga/kaksha``
|
|
210
|
+
"""
|
|
211
|
+
_q: QueryParams = {}
|
|
212
|
+
put_fields(_q, birth, "birth.")
|
|
213
|
+
put(_q, "date", date)
|
|
214
|
+
put(_q, "time", time)
|
|
215
|
+
put(_q, "tz", tz)
|
|
216
|
+
put(_q, "ayanamsa", ayanamsa)
|
|
217
|
+
put(_q, "lang", lang)
|
|
218
|
+
put(_q, "locale", lang)
|
|
219
|
+
return await self._c.request("/v1/ashtakavarga/kaksha", _q, request_options=request_options)
|
|
220
|
+
|
|
221
|
+
async def sarva(
|
|
222
|
+
self,
|
|
223
|
+
*,
|
|
224
|
+
lat: float,
|
|
225
|
+
lon: float,
|
|
226
|
+
date: str,
|
|
227
|
+
time: str,
|
|
228
|
+
tz: str,
|
|
229
|
+
ayanamsa: Ayanamsa | None = None,
|
|
230
|
+
request_options: RequestOptions | None = None,
|
|
231
|
+
) -> Any:
|
|
232
|
+
"""Get the Sarvashtakavarga table — the combined 12-sign benefic-point grid from all 9
|
|
233
|
+
grahas.
|
|
234
|
+
|
|
235
|
+
Cost: 20 credits per call.
|
|
236
|
+
|
|
237
|
+
Wire names: ``lat`` -> ``birth.lat``, ``lon`` -> ``birth.lon``, ``date`` -> ``birth.date``,
|
|
238
|
+
``time`` -> ``birth.time``, ``tz`` -> ``birth.tz``.
|
|
239
|
+
|
|
240
|
+
``GET /v1/ashtakavarga/sarva``
|
|
241
|
+
"""
|
|
242
|
+
_q: QueryParams = {}
|
|
243
|
+
put(_q, "birth.lat", lat)
|
|
244
|
+
put(_q, "birth.lon", lon)
|
|
245
|
+
put(_q, "birth.date", date)
|
|
246
|
+
put(_q, "birth.time", time)
|
|
247
|
+
put(_q, "birth.tz", tz)
|
|
248
|
+
put(_q, "ayanamsa", ayanamsa)
|
|
249
|
+
return await self._c.request("/v1/ashtakavarga/sarva", _q, request_options=request_options)
|
|
250
|
+
|
|
251
|
+
async def transit_score(
|
|
252
|
+
self,
|
|
253
|
+
*,
|
|
254
|
+
birth: BirthInput,
|
|
255
|
+
date: str,
|
|
256
|
+
time: str,
|
|
257
|
+
tz: str,
|
|
258
|
+
ayanamsa: Ayanamsa | None = None,
|
|
259
|
+
lang: Locale | None = None,
|
|
260
|
+
request_options: RequestOptions | None = None,
|
|
261
|
+
) -> Any:
|
|
262
|
+
"""Score current (or a given date's) planetary transits against a natal chart using
|
|
263
|
+
Ashtakavarga benefic points.
|
|
264
|
+
|
|
265
|
+
Cost: 20 credits per call.
|
|
266
|
+
|
|
267
|
+
``GET /v1/ashtakavarga/transit-score``
|
|
268
|
+
"""
|
|
269
|
+
_q: QueryParams = {}
|
|
270
|
+
put_fields(_q, birth, "birth.")
|
|
271
|
+
put(_q, "date", date)
|
|
272
|
+
put(_q, "time", time)
|
|
273
|
+
put(_q, "tz", tz)
|
|
274
|
+
put(_q, "ayanamsa", ayanamsa)
|
|
275
|
+
put(_q, "lang", lang)
|
|
276
|
+
put(_q, "locale", lang)
|
|
277
|
+
return await self._c.request(
|
|
278
|
+
"/v1/ashtakavarga/transit-score", _q, request_options=request_options
|
|
279
|
+
)
|