mahadasha 0.1.0__tar.gz

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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mahadasha.com
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,155 @@
1
+ Metadata-Version: 2.4
2
+ Name: mahadasha
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the Mahadasha Swiss Ephemeris Vedic Astrology API (Kundli, Vimshottari Dasha, Divisional Charts, Shadbala, Ashtakavarga, Panchang & Matching).
5
+ Author-email: "Mahadasha.com" <support@mahadasha.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://mahadasha.com/developers
8
+ Project-URL: Documentation, https://mahadasha.docs.buildwithfern.com/
9
+ Project-URL: API Portal, https://mahadasha.com/dashboard/developer
10
+ Project-URL: Postman Workspace, https://www.postman.com/mahadasha-6234802/mahadasha-vedic-astrology-api/
11
+ Project-URL: Support, https://mahadasha.com/contact
12
+ Keywords: vedic-astrology,jyotish,kundli,swiss-ephemeris,astrology-api,panchang,dasha,ashtakavarga,shadbala,numerology,mahadasha
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.9
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: httpx>=0.25.0
29
+ Dynamic: license-file
30
+
31
+ # mahadasha
32
+
33
+ Official Python SDK for the **[Mahadasha Vedic Astrology API](https://mahadasha.com/developers)** — stateless Swiss Ephemeris calculations returned as clean JSON for apps, backends, and AI agents.
34
+
35
+ - **Website & API Keys:** [mahadasha.com/developers](https://mahadasha.com/developers)
36
+ - **Interactive API Docs:** [mahadasha.docs.buildwithfern.com](https://mahadasha.docs.buildwithfern.com/)
37
+ - **Postman Collection:** [Postman Public Workspace](https://www.postman.com/mahadasha-6234802/mahadasha-vedic-astrology-api/)
38
+ - **Free MCP Server (AI Agents):** `https://mahadasha.com/api/mcp`
39
+
40
+ ## Features
41
+
42
+ - **14 Vedic Calculation & Utility Endpoints:** Birth chart (D1 Kundli), raw planetary longitudes, Bhava Chalit cusps (7 house systems), Vimshottari Dasha, 15 Divisional Charts (`D2`–`D60`), Shadbala, Ashtakavarga (`BAV` + `SAV`), Doshas (Manglik, Kaal Sarpa, Sade Sati, Pitra), Panchang, Gochar Transits, Ashta Koota Kundali Matching, Numerology (Pythagorean & Chaldean), Horoscope, and 624,000+ Place Lookup.
43
+ - **Sync & Async Clients:** `MahadashaClient` and `AsyncMahadashaClient` backed by `httpx`.
44
+ - **Built-in Rate-Limit Retries:** Automatically respects `Retry-After` on `429` burst limits and retries transient `5xx` errors (failed calls never count against your quota).
45
+ - **Zero PII Storage:** Birth details are computed in memory and never stored.
46
+
47
+ ## Installation
48
+
49
+ ```bash
50
+ pip install mahadasha
51
+ ```
52
+
53
+ ## Quickstart
54
+
55
+ Get a free API key (1,000 calls/month, no credit card) at **[mahadasha.com/dashboard/developer](https://mahadasha.com/dashboard/developer)**.
56
+
57
+ ```python
58
+ from mahadasha import MahadashaClient
59
+
60
+ client = MahadashaClient(api_key="md_live_your_key_here") # or set MAHADASHA_API_KEY env var
61
+
62
+ # 1. Look up coordinates and timezone
63
+ places = client.find_place("Varanasi", limit=1)
64
+ place = places["data"]["matches"][0]
65
+
66
+ # 2. Cast a sidereal Kundli (D1)
67
+ kundli = client.kundli(
68
+ birth_date="1990-05-15",
69
+ birth_time="14:30",
70
+ latitude=place["latitude"],
71
+ longitude=place["longitude"],
72
+ timezone=place["timezone"],
73
+ )
74
+ print(kundli["data"]["ascendant"])
75
+
76
+ # 3. Check Vimshottari Dasha periods
77
+ dashas = client.dashas(
78
+ birth_date="1990-05-15",
79
+ birth_time="14:30",
80
+ latitude=28.6139,
81
+ longitude=77.2090,
82
+ timezone="Asia/Kolkata",
83
+ as_of="2026-11-27",
84
+ )
85
+ print(dashas["data"]["current"])
86
+ ```
87
+
88
+ ### Async Usage
89
+
90
+ ```python
91
+ import asyncio
92
+ from mahadasha import AsyncMahadashaClient
93
+
94
+ async def main():
95
+ async with AsyncMahadashaClient() as client: # reads MAHADASHA_API_KEY
96
+ panchang = await client.panchang(
97
+ latitude=28.6139,
98
+ longitude=77.2090,
99
+ timezone="Asia/Kolkata",
100
+ date="2026-11-27",
101
+ )
102
+ print(panchang["data"]["tithi"])
103
+
104
+ asyncio.run(main())
105
+ ```
106
+
107
+ ## All Available Methods
108
+
109
+ | Method | Endpoint | Purpose |
110
+ |---|---|---|
111
+ | `find_place(query, limit=5)` | `GET /find-place` | Look up latitude, longitude & IANA timezone |
112
+ | `kundli(...)` | `POST /kundli` | D1 Birth chart (Ascendant, Moon sign, 9 grahas, houses) |
113
+ | `planetary_positions(...)` | `POST /planetary-positions` | Sidereal longitudes, speed, retrograde & combustion |
114
+ | `bhavas(...)` | `POST /bhavas` | Bhava Chalit cusps (`Sripathi`, `Placidus`, `Koch`, `WholeSign`, etc.) |
115
+ | `dashas(...)` | `POST /dashas` | Vimshottari Mahadasha, Antardasha & Pratyantardasha |
116
+ | `divisional_charts(..., chart="D9")` | `POST /divisional-charts` | BPHS Vargas (`D2` to `D60`) |
117
+ | `shadbala(...)` | `POST /shadbala` | Six-fold planetary strength in Rupas & Shashtiamsas |
118
+ | `ashtakavarga(...)` | `POST /ashtakavarga` | Bhinnashtakavarga & Sarvashtakavarga (totals 337) |
119
+ | `doshas(...)` | `POST /doshas` | Manglik, Kaal Sarpa, Sade Sati & Pitra Dosha |
120
+ | `panchang(...)` | `POST /panchang` | Tithi, Vara, Nakshatra, Yoga, Karana, Sunrise & Muhurtas |
121
+ | `transits(...)` | `POST /transits` | Gochar transits relative to natal Moon & Lagna |
122
+ | `kundali_matching(groom, bride)` | `POST /kundali-matching` | Ashta Koota 36-guna compatibility |
123
+ | `numerology(birth_date, ...)` | `POST /numerology` | Pythagorean & Chaldean core numbers |
124
+ | `horoscope(sign, ...)` | `POST /horoscope` | Daily, weekly, monthly & yearly horoscope (`en`/`hi`, paid plans) |
125
+ | `usage()` | `GET /usage` | Live quota & rate-limit summary (unmetered) |
126
+ | `status()` | `GET /status` | Service health & maintenance status (public) |
127
+
128
+ ## Rate Limits & Error Handling
129
+
130
+ Every response exposes `client.last_rate_limit` (`limit`, `remaining`, `reset`, `burst`, `plan`, `request_id`).
131
+
132
+ ```python
133
+ from mahadasha import MahadashaClient, RateLimitError, MahadashaError
134
+
135
+ client = MahadashaClient(api_key="md_live_...", max_retries=2)
136
+
137
+ try:
138
+ result = client.shadbala(
139
+ birth_date="1990-05-15",
140
+ birth_time="14:30",
141
+ latitude=28.6139,
142
+ longitude=77.2090,
143
+ timezone="Asia/Kolkata",
144
+ )
145
+ except RateLimitError as exc:
146
+ print(f"Rate limited ({exc.code}). Retry after {exc.retry_after}s")
147
+ except MahadashaError as exc:
148
+ print(f"API error [{exc.code}] (request_id={exc.request_id}): {exc}")
149
+ ```
150
+
151
+ ## Links
152
+
153
+ - [Mahadasha.com](https://mahadasha.com) — Kundli calculators, Panchang & Vedic Astrology platform
154
+ - [Developer Pricing & Plans](https://mahadasha.com/developers)
155
+ - [Support](mailto:support@mahadasha.com)
@@ -0,0 +1,125 @@
1
+ # mahadasha
2
+
3
+ Official Python SDK for the **[Mahadasha Vedic Astrology API](https://mahadasha.com/developers)** — stateless Swiss Ephemeris calculations returned as clean JSON for apps, backends, and AI agents.
4
+
5
+ - **Website & API Keys:** [mahadasha.com/developers](https://mahadasha.com/developers)
6
+ - **Interactive API Docs:** [mahadasha.docs.buildwithfern.com](https://mahadasha.docs.buildwithfern.com/)
7
+ - **Postman Collection:** [Postman Public Workspace](https://www.postman.com/mahadasha-6234802/mahadasha-vedic-astrology-api/)
8
+ - **Free MCP Server (AI Agents):** `https://mahadasha.com/api/mcp`
9
+
10
+ ## Features
11
+
12
+ - **14 Vedic Calculation & Utility Endpoints:** Birth chart (D1 Kundli), raw planetary longitudes, Bhava Chalit cusps (7 house systems), Vimshottari Dasha, 15 Divisional Charts (`D2`–`D60`), Shadbala, Ashtakavarga (`BAV` + `SAV`), Doshas (Manglik, Kaal Sarpa, Sade Sati, Pitra), Panchang, Gochar Transits, Ashta Koota Kundali Matching, Numerology (Pythagorean & Chaldean), Horoscope, and 624,000+ Place Lookup.
13
+ - **Sync & Async Clients:** `MahadashaClient` and `AsyncMahadashaClient` backed by `httpx`.
14
+ - **Built-in Rate-Limit Retries:** Automatically respects `Retry-After` on `429` burst limits and retries transient `5xx` errors (failed calls never count against your quota).
15
+ - **Zero PII Storage:** Birth details are computed in memory and never stored.
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ pip install mahadasha
21
+ ```
22
+
23
+ ## Quickstart
24
+
25
+ Get a free API key (1,000 calls/month, no credit card) at **[mahadasha.com/dashboard/developer](https://mahadasha.com/dashboard/developer)**.
26
+
27
+ ```python
28
+ from mahadasha import MahadashaClient
29
+
30
+ client = MahadashaClient(api_key="md_live_your_key_here") # or set MAHADASHA_API_KEY env var
31
+
32
+ # 1. Look up coordinates and timezone
33
+ places = client.find_place("Varanasi", limit=1)
34
+ place = places["data"]["matches"][0]
35
+
36
+ # 2. Cast a sidereal Kundli (D1)
37
+ kundli = client.kundli(
38
+ birth_date="1990-05-15",
39
+ birth_time="14:30",
40
+ latitude=place["latitude"],
41
+ longitude=place["longitude"],
42
+ timezone=place["timezone"],
43
+ )
44
+ print(kundli["data"]["ascendant"])
45
+
46
+ # 3. Check Vimshottari Dasha periods
47
+ dashas = client.dashas(
48
+ birth_date="1990-05-15",
49
+ birth_time="14:30",
50
+ latitude=28.6139,
51
+ longitude=77.2090,
52
+ timezone="Asia/Kolkata",
53
+ as_of="2026-11-27",
54
+ )
55
+ print(dashas["data"]["current"])
56
+ ```
57
+
58
+ ### Async Usage
59
+
60
+ ```python
61
+ import asyncio
62
+ from mahadasha import AsyncMahadashaClient
63
+
64
+ async def main():
65
+ async with AsyncMahadashaClient() as client: # reads MAHADASHA_API_KEY
66
+ panchang = await client.panchang(
67
+ latitude=28.6139,
68
+ longitude=77.2090,
69
+ timezone="Asia/Kolkata",
70
+ date="2026-11-27",
71
+ )
72
+ print(panchang["data"]["tithi"])
73
+
74
+ asyncio.run(main())
75
+ ```
76
+
77
+ ## All Available Methods
78
+
79
+ | Method | Endpoint | Purpose |
80
+ |---|---|---|
81
+ | `find_place(query, limit=5)` | `GET /find-place` | Look up latitude, longitude & IANA timezone |
82
+ | `kundli(...)` | `POST /kundli` | D1 Birth chart (Ascendant, Moon sign, 9 grahas, houses) |
83
+ | `planetary_positions(...)` | `POST /planetary-positions` | Sidereal longitudes, speed, retrograde & combustion |
84
+ | `bhavas(...)` | `POST /bhavas` | Bhava Chalit cusps (`Sripathi`, `Placidus`, `Koch`, `WholeSign`, etc.) |
85
+ | `dashas(...)` | `POST /dashas` | Vimshottari Mahadasha, Antardasha & Pratyantardasha |
86
+ | `divisional_charts(..., chart="D9")` | `POST /divisional-charts` | BPHS Vargas (`D2` to `D60`) |
87
+ | `shadbala(...)` | `POST /shadbala` | Six-fold planetary strength in Rupas & Shashtiamsas |
88
+ | `ashtakavarga(...)` | `POST /ashtakavarga` | Bhinnashtakavarga & Sarvashtakavarga (totals 337) |
89
+ | `doshas(...)` | `POST /doshas` | Manglik, Kaal Sarpa, Sade Sati & Pitra Dosha |
90
+ | `panchang(...)` | `POST /panchang` | Tithi, Vara, Nakshatra, Yoga, Karana, Sunrise & Muhurtas |
91
+ | `transits(...)` | `POST /transits` | Gochar transits relative to natal Moon & Lagna |
92
+ | `kundali_matching(groom, bride)` | `POST /kundali-matching` | Ashta Koota 36-guna compatibility |
93
+ | `numerology(birth_date, ...)` | `POST /numerology` | Pythagorean & Chaldean core numbers |
94
+ | `horoscope(sign, ...)` | `POST /horoscope` | Daily, weekly, monthly & yearly horoscope (`en`/`hi`, paid plans) |
95
+ | `usage()` | `GET /usage` | Live quota & rate-limit summary (unmetered) |
96
+ | `status()` | `GET /status` | Service health & maintenance status (public) |
97
+
98
+ ## Rate Limits & Error Handling
99
+
100
+ Every response exposes `client.last_rate_limit` (`limit`, `remaining`, `reset`, `burst`, `plan`, `request_id`).
101
+
102
+ ```python
103
+ from mahadasha import MahadashaClient, RateLimitError, MahadashaError
104
+
105
+ client = MahadashaClient(api_key="md_live_...", max_retries=2)
106
+
107
+ try:
108
+ result = client.shadbala(
109
+ birth_date="1990-05-15",
110
+ birth_time="14:30",
111
+ latitude=28.6139,
112
+ longitude=77.2090,
113
+ timezone="Asia/Kolkata",
114
+ )
115
+ except RateLimitError as exc:
116
+ print(f"Rate limited ({exc.code}). Retry after {exc.retry_after}s")
117
+ except MahadashaError as exc:
118
+ print(f"API error [{exc.code}] (request_id={exc.request_id}): {exc}")
119
+ ```
120
+
121
+ ## Links
122
+
123
+ - [Mahadasha.com](https://mahadasha.com) — Kundli calculators, Panchang & Vedic Astrology platform
124
+ - [Developer Pricing & Plans](https://mahadasha.com/developers)
125
+ - [Support](mailto:support@mahadasha.com)
@@ -0,0 +1,60 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "mahadasha"
7
+ version = "0.1.0"
8
+ description = "Official Python SDK for the Mahadasha Swiss Ephemeris Vedic Astrology API (Kundli, Vimshottari Dasha, Divisional Charts, Shadbala, Ashtakavarga, Panchang & Matching)."
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ requires-python = ">=3.9"
12
+ authors = [
13
+ {name = "Mahadasha.com", email = "support@mahadasha.com"},
14
+ ]
15
+ keywords = [
16
+ "vedic-astrology",
17
+ "jyotish",
18
+ "kundli",
19
+ "swiss-ephemeris",
20
+ "astrology-api",
21
+ "panchang",
22
+ "dasha",
23
+ "ashtakavarga",
24
+ "shadbala",
25
+ "numerology",
26
+ "mahadasha",
27
+ ]
28
+ classifiers = [
29
+ "Development Status :: 4 - Beta",
30
+ "Intended Audience :: Developers",
31
+ "License :: OSI Approved :: MIT License",
32
+ "Operating System :: OS Independent",
33
+ "Programming Language :: Python :: 3",
34
+ "Programming Language :: Python :: 3.9",
35
+ "Programming Language :: Python :: 3.10",
36
+ "Programming Language :: Python :: 3.11",
37
+ "Programming Language :: Python :: 3.12",
38
+ "Programming Language :: Python :: 3.13",
39
+ "Topic :: Software Development :: Libraries :: Python Modules",
40
+ "Typing :: Typed",
41
+ ]
42
+ dependencies = [
43
+ "httpx>=0.25.0",
44
+ ]
45
+
46
+ [project.urls]
47
+ Homepage = "https://mahadasha.com/developers"
48
+ Documentation = "https://mahadasha.docs.buildwithfern.com/"
49
+ "API Portal" = "https://mahadasha.com/dashboard/developer"
50
+ "Postman Workspace" = "https://www.postman.com/mahadasha-6234802/mahadasha-vedic-astrology-api/"
51
+ Support = "https://mahadasha.com/contact"
52
+
53
+ [tool.setuptools.packages.find]
54
+ where = ["src"]
55
+
56
+ [tool.setuptools.package-data]
57
+ mahadasha = ["py.typed"]
58
+
59
+ [tool.pytest.ini_options]
60
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,28 @@
1
+ """Official Python SDK for the Mahadasha Vedic Astrology API."""
2
+ from .client import AsyncMahadashaClient, DEFAULT_BASE_URL, MahadashaClient, RateLimitInfo
3
+ from .exceptions import (
4
+ AuthenticationError,
5
+ MahadashaError,
6
+ NotFoundError,
7
+ PermissionError,
8
+ RateLimitError,
9
+ ServiceUnavailableError,
10
+ ValidationError,
11
+ )
12
+
13
+ __version__ = "0.1.0"
14
+
15
+ __all__ = [
16
+ "__version__",
17
+ "DEFAULT_BASE_URL",
18
+ "MahadashaClient",
19
+ "AsyncMahadashaClient",
20
+ "RateLimitInfo",
21
+ "MahadashaError",
22
+ "AuthenticationError",
23
+ "PermissionError",
24
+ "ValidationError",
25
+ "NotFoundError",
26
+ "RateLimitError",
27
+ "ServiceUnavailableError",
28
+ ]