-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
191 lines (178 loc) · 5.8 KB
/
config.py
File metadata and controls
191 lines (178 loc) · 5.8 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
"""Configuration types and constants for the Astrology API client."""
from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass, field
from typing import Any, Literal
# API Configuration
DEFAULT_BASE_URL = "https://api.astrology-api.io"
DEFAULT_TIMEOUT = 10.0 # seconds
DEFAULT_RETRY_STATUS_CODES = [408, 425, 429, 500, 502, 503, 504]
# Validation Ranges
YEAR_RANGE = (1900, 2100)
MONTH_RANGE = (1, 12)
DAY_RANGE = (1, 31)
HOUR_RANGE = (0, 23)
MINUTE_RANGE = (0, 59)
SECOND_RANGE = (0, 59)
LATITUDE_RANGE = (-90.0, 90.0)
LONGITUDE_RANGE = (-180.0, 180.0)
ORB_RANGE = (0.0, 10.0)
HOUSE_NUMBER_RANGE = (1, 12)
# Type Aliases
HouseSystem = Literal["P", "W", "K", "A", "R", "C", "O", "M", "B", "E", "V", "X", "H", "T", "G"]
ZodiacType = Literal["Tropic", "Sidereal"]
Language = Literal["en", "es", "fr", "de", "it", "pt", "ru", "zh", "ja", "hi", "uk", "tr"]
DetailLevel = Literal["basic", "standard", "full", "professional"]
ChartType = Literal["natal", "transit", "synastry", "composite"]
AspectType = Literal["major", "minor", "all"]
PlanetType = Literal["classical", "modern", "all"]
ReportType = Literal["natal", "transit", "synastry", "composite"]
Period = Literal["daily", "weekly", "monthly", "yearly"]
Sign = Literal[
"Aries",
"Taurus",
"Gemini",
"Cancer",
"Leo",
"Virgo",
"Libra",
"Scorpio",
"Sagittarius",
"Capricorn",
"Aquarius",
"Pisces",
]
ChineseElement = Literal["Wood", "Fire", "Earth", "Metal", "Water"]
ChineseAnimal = Literal[
"Rat",
"Ox",
"Tiger",
"Rabbit",
"Dragon",
"Snake",
"Horse",
"Goat",
"Monkey",
"Rooster",
"Dog",
"Pig",
]
TarotSpread = Literal["single", "three_card", "celtic_cross", "relationship", "career"]
TarotReportSpread = Literal[
"single", "three_card", "celtic_cross", "zodiac_wheel", "synastry", "houses", "custom"
]
TarotTradition = Literal["universal", "psychological", "classical", "hermetic"]
TarotInterpretationDepth = Literal["keywords", "basic", "detailed", "professional"]
NumerologySystem = Literal["pythagorean", "chaldean"]
ProgressionType = Literal["secondary", "solar_arc", "tertiary"]
DirectionType = Literal["primary", "symbolic", "solar_arc"]
AnalysisDirectionType = Literal["solar_arc", "symbolic", "profection", "naibod"]
ReturnType = Literal["solar", "lunar", "mercury", "venus", "mars"]
ReturnDirection = Literal["next", "previous", "nearest"]
PreferredPass = Literal["first", "last_direct", "nearest"]
TextFormat = Literal["short", "paragraph", "bullets", "structured", "long"]
HoraryCategory = Literal[
"pregnancy",
"fertility",
"love",
"marriage",
"career",
"job",
"money",
"health",
"missing_item",
"travel",
"general",
]
Gender = Literal["male", "female"]
ChineseTradition = Literal["classical", "modern", "simplified"]
AnalysisDepth = Literal["basic", "standard", "comprehensive", "professional"]
RenderFormat = Literal["svg", "png", "jpg", "webp", "pdf"]
RenderTheme = Literal["light", "dark", "dark-high-contrast", "classic"]
PdfTheme = Literal["light", "dark", "minimal", "luxury", "cosmic"]
PdfFontStyle = Literal["modern", "classic", "elegant", "technical"]
PdfPageSize = Literal["A4", "Letter", "Legal", "A3", "A5"]
PdfOrientation = Literal["portrait", "landscape"]
PdfSign = Literal[
"Ari", "Tau", "Gem", "Can", "Leo", "Vir", "Lib", "Sco", "Sag", "Cap", "Aqu", "Pis"
]
KabbalahSystem = Literal["classical", "modern_halevi", "golden_dawn"]
TikkunMethod = Literal["berg", "zodiac", "lunar_node", "all"]
GematriaMethod = Literal["mispar_gadol", "mispar_katan", "ordinal", "atbash", "albam"]
VedicAyanamsa = Literal[
"lahiri",
"krishnamurti",
"raman",
"yukteshwar",
"true_citra",
"jn_bhasin",
"ushashashi",
"true_revati",
"true_pushya",
"ss_citra",
"suryasiddhanta",
"fagan_bradley",
]
VedicNodeType = Literal["mean", "true"]
VedicBhavaSystem = Literal["equal", "whole_sign", "placidus", "koch", "sripati"]
VedicDivisionalChart = Literal[
"D1",
"D2",
"D3",
"D4",
"D7",
"D9",
"D10",
"D12",
"D16",
"D20",
"D24",
"D27",
"D30",
"D40",
"D45",
"D60",
]
VedicDashaLevel = Literal["mahadasha", "antardasha", "pratyantardasha", "sukshma", "prana"]
VedicRemedyType = Literal["all", "gemstones", "mantras", "pujas", "rudrakshas"]
VedicYogaCategory = Literal[
"pancha_mahapurusha",
"chandra_yoga",
"surya_yoga",
"raj_yoga",
"dhana_yoga",
"viparita_yoga",
"dosha",
]
VedicFestivalType = Literal["major", "regional", "religious", "fasting", "auspicious"]
VedicChartStyle = Literal["north_indian", "south_indian"]
VedicSignFormat = Literal["english", "sanskrit", "devanagari"]
VedicChartTheme = Literal["traditional", "dark", "modern_light"]
@dataclass
class RetryConfig:
"""Configuration for HTTP retry logic.
Attributes:
attempts: Number of retry attempts (0 = no retries)
delay_ms: Delay between retries in milliseconds
retry_status_codes: HTTP status codes that trigger retries
"""
attempts: int = 0
delay_ms: int = 250
retry_status_codes: list[int] = field(default_factory=DEFAULT_RETRY_STATUS_CODES.copy)
@dataclass
class AstrologyClientConfig:
"""Configuration for the Astrology API client.
Attributes:
api_key: API key for authentication (if None, reads from ASTROLOGY_API_KEY env var)
base_url: Base URL for the API
timeout: Request timeout in seconds
retry: Retry configuration (None = no retries)
debug: Enable debug logging
logger: Custom logging function (message: str, details: Any) -> None
"""
api_key: str | None = None
base_url: str = DEFAULT_BASE_URL
timeout: float = DEFAULT_TIMEOUT
retry: RetryConfig | None = None
debug: bool = False
logger: Callable[[str, Any], None] | None = None