-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhorary.py
More file actions
62 lines (51 loc) · 2.46 KB
/
horary.py
File metadata and controls
62 lines (51 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"""Horary category client for horary astrology."""
from __future__ import annotations
from astroapi.categories.base import BaseCategoryClient
from astroapi.types.requests import (
HoraryAnalyzeRequest,
HoraryAspectsRequest,
HoraryChartRequest,
HoraryFertilityRequest,
)
from astroapi.types.responses import GenericResponse
from astroapi.utils.validators import validate_datetime_location
class HoraryClient(BaseCategoryClient):
"""Client for horary astrology endpoints."""
API_PREFIX = "/api/v3/horary"
def get_chart(self, request: HoraryChartRequest) -> GenericResponse:
"""Generate horary chart."""
validate_datetime_location(request.question_time)
url = self._build_url("chart")
data = self._http.post(url, json=request.model_dump(exclude_none=True))
return GenericResponse(**data)
def analyze(self, request: HoraryAnalyzeRequest) -> GenericResponse:
"""Analyze horary question."""
validate_datetime_location(request.question_time)
url = self._build_url("analyze")
data = self._http.post(url, json=request.model_dump(exclude_none=True))
return GenericResponse(**data)
def get_aspects(self, request: HoraryAspectsRequest) -> GenericResponse:
"""Get horary aspects."""
validate_datetime_location(request.question_time)
url = self._build_url("aspects")
data = self._http.post(url, json=request.model_dump(exclude_none=True))
return GenericResponse(**data)
def get_fertility_analysis(self, request: HoraryFertilityRequest) -> GenericResponse:
"""Analyze fertility horary question."""
validate_datetime_location(request.question_time)
url = self._build_url("fertility-analysis")
data = self._http.post(url, json=request.model_dump(exclude_none=True))
return GenericResponse(**data)
def get_considerations_glossary(self) -> GenericResponse:
"""Get horary considerations glossary."""
url = self._build_url("glossary", "considerations")
data = self._http.get(url)
return GenericResponse(**data)
def get_categories_glossary(self, language: str | None = None) -> GenericResponse:
"""Get horary categories glossary."""
url = self._build_url("glossary", "categories")
params: dict[str, str] = {}
if language:
params["language"] = language
data = self._http.get(url, params=params or None)
return GenericResponse(**data)