-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastrocartography.py
More file actions
141 lines (114 loc) · 5.37 KB
/
astrocartography.py
File metadata and controls
141 lines (114 loc) · 5.37 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
"""Astrocartography category client."""
from __future__ import annotations
from astroapi.categories.base import BaseCategoryClient
from astroapi.types.requests import (
AstrocartographyMapRequest,
AstrocartographyRequest,
AstrodynesRequest,
CompareAstrodynesRequest,
CompareLocationsRequest,
LocationAnalysisRequest,
ParanMapRequest,
PowerZonesRequest,
SearchLocationsRequest,
)
from astroapi.types.responses import AstrocartographyResponse, GenericResponse
from astroapi.utils.validators import validate_subject
class AstrocartographyClient(BaseCategoryClient):
"""Client for astrocartography endpoints.
Provides planetary line calculations for location mapping.
"""
API_PREFIX = "/api/v3/astrocartography"
def get_lines(self, request: AstrocartographyRequest) -> AstrocartographyResponse:
"""Get astrocartography lines.
Args:
request: Astrocartography request parameters
Returns:
Astrocartography lines response
Raises:
AstrologyError: If validation fails or API request fails
"""
validate_subject(request.subject)
url = self._build_url("lines")
data = self._http.post(url, json=request.model_dump(exclude_none=True))
return AstrocartographyResponse(**data)
def get_relocated_chart(self, request: AstrocartographyRequest) -> AstrocartographyResponse:
"""Get relocated chart data.
Args:
request: Astrocartography request parameters
Returns:
Relocated chart response
Raises:
AstrologyError: If validation fails or API request fails
"""
validate_subject(request.subject)
url = self._build_url("relocated")
data = self._http.post(url, json=request.model_dump(exclude_none=True))
return AstrocartographyResponse(**data)
def get_line_meanings(self, language: str | None = None) -> GenericResponse:
"""Get astrocartography line meanings."""
params = {}
if language:
params["language"] = language
url = self._build_url("line-meanings")
data = self._http.get(url, params=params if params else None)
return GenericResponse(**data)
def get_supported_features(self) -> GenericResponse:
"""Get supported astrocartography features."""
url = self._build_url("supported-features")
data = self._http.get(url)
return GenericResponse(**data)
def get_map(self, request: AstrocartographyMapRequest) -> GenericResponse:
"""Get astrocartography map data."""
validate_subject(request.subject)
url = self._build_url("map")
data = self._http.post(url, json=request.model_dump(exclude_none=True))
return GenericResponse(**data)
def render_map(self, request: AstrocartographyMapRequest) -> GenericResponse:
"""Render astrocartography map."""
validate_subject(request.subject)
url = self._build_url("render")
data = self._http.post(url, json=request.model_dump(exclude_none=True))
return GenericResponse(**data)
def analyze_location(self, request: LocationAnalysisRequest) -> GenericResponse:
"""Analyze a specific location."""
validate_subject(request.subject)
url = self._build_url("location-analysis")
data = self._http.post(url, json=request.model_dump(exclude_none=True))
return GenericResponse(**data)
def search_locations(self, request: SearchLocationsRequest) -> GenericResponse:
"""Search for optimal locations."""
validate_subject(request.subject)
url = self._build_url("search-locations")
data = self._http.post(url, json=request.model_dump(exclude_none=True))
return GenericResponse(**data)
def compare_locations(self, request: CompareLocationsRequest) -> GenericResponse:
"""Compare multiple locations."""
validate_subject(request.subject)
url = self._build_url("compare-locations")
data = self._http.post(url, json=request.model_dump(exclude_none=True))
return GenericResponse(**data)
def get_power_zones(self, request: PowerZonesRequest) -> GenericResponse:
"""Get power zones."""
validate_subject(request.subject)
url = self._build_url("power-zones")
data = self._http.post(url, json=request.model_dump(exclude_none=True))
return GenericResponse(**data)
def get_paran_map(self, request: ParanMapRequest) -> GenericResponse:
"""Get paran map data."""
validate_subject(request.subject)
url = self._build_url("paran-map")
data = self._http.post(url, json=request.model_dump(exclude_none=True))
return GenericResponse(**data)
def get_astrodynes(self, request: AstrodynesRequest) -> GenericResponse:
"""Get astrodynes calculation."""
validate_subject(request.subject)
url = self._build_url("astrodynes")
data = self._http.post(url, json=request.model_dump(exclude_none=True))
return GenericResponse(**data)
def compare_astrodynes(self, request: CompareAstrodynesRequest) -> GenericResponse:
"""Compare astrodynes across locations."""
validate_subject(request.subject)
url = self._build_url("astrodynes", "compare")
data = self._http.post(url, json=request.model_dump(exclude_none=True))
return GenericResponse(**data)