roxy-sdk 0.1.1__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.
- roxy_sdk-0.1.1/LICENSE +21 -0
- roxy_sdk-0.1.1/PKG-INFO +246 -0
- roxy_sdk-0.1.1/README.md +222 -0
- roxy_sdk-0.1.1/pyproject.toml +63 -0
- roxy_sdk-0.1.1/src/roxy_sdk/__init__.py +7 -0
- roxy_sdk-0.1.1/src/roxy_sdk/factory.py +3064 -0
- roxy_sdk-0.1.1/src/roxy_sdk/py.typed +0 -0
- roxy_sdk-0.1.1/src/roxy_sdk/version.py +1 -0
roxy_sdk-0.1.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RoxyAPI
|
|
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.
|
roxy_sdk-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: roxy-sdk
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Python SDK for RoxyAPI. Astrology, tarot, numerology, and more.
|
|
5
|
+
Keywords: astrology,tarot,numerology,api,sdk,vedic,horoscope
|
|
6
|
+
Author: RoxyAPI
|
|
7
|
+
Author-email: RoxyAPI <hi@roxyapi.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Dist: httpx>=0.27.0
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Project-URL: Homepage, https://roxyapi.com
|
|
21
|
+
Project-URL: Repository, https://github.com/RoxyAPI/sdk-python
|
|
22
|
+
Project-URL: Documentation, https://roxyapi.com/docs
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# roxy-sdk
|
|
26
|
+
|
|
27
|
+
[](https://pypi.org/project/roxy-sdk/)
|
|
28
|
+
[](https://pypi.org/project/roxy-sdk/)
|
|
29
|
+
[](https://roxyapi.com/docs)
|
|
30
|
+
[](https://roxyapi.com/api-reference)
|
|
31
|
+
[](https://github.com/RoxyAPI/sdk-python/blob/main/LICENSE)
|
|
32
|
+
|
|
33
|
+
Python SDK for [RoxyAPI](https://roxyapi.com). Astrology, tarot, numerology, I Ching, crystals, angel numbers, dream interpretation, biorhythm, and more. One API key, 11 domains, 120+ endpoints.
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install roxy-sdk
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Quickstart
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from roxy_sdk import create_roxy
|
|
45
|
+
|
|
46
|
+
roxy = create_roxy("your-api-key")
|
|
47
|
+
horoscope = roxy.astrology.get_daily_horoscope(sign="aries")
|
|
48
|
+
print(horoscope)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Get your API key at [roxyapi.com/pricing](https://roxyapi.com/pricing). Free test keys available on the [interactive docs](https://roxyapi.com/api-reference).
|
|
52
|
+
|
|
53
|
+
## Recipes
|
|
54
|
+
|
|
55
|
+
### Dating app: zodiac compatibility
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
person1 = {"date": "1990-01-15", "time": "14:30:00", "latitude": 28.61, "longitude": 77.20}
|
|
59
|
+
person2 = {"date": "1992-07-22", "time": "09:00:00", "latitude": 19.07, "longitude": 72.87}
|
|
60
|
+
|
|
61
|
+
score = roxy.astrology.calculate_compatibility(person1=person1, person2=person2)
|
|
62
|
+
print(f"Compatibility: {score}")
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Wellness app: daily tarot card
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
card = roxy.tarot.get_daily_card()
|
|
69
|
+
print(f"Today: {card}")
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Journaling app: dream interpretation
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
symbol = roxy.dreams.get_dream_symbol(id="flying")
|
|
76
|
+
print(f"Flying in dreams: {symbol}")
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Numerology calculator: life path number
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
result = roxy.numerology.calculate_life_path(year=1990, month=1, day=15)
|
|
83
|
+
print(f"Life Path: {result}")
|
|
84
|
+
|
|
85
|
+
chart = roxy.numerology.generate_numerology_chart(full_name="Jane Smith", year=1990, month=1, day=15)
|
|
86
|
+
print(f"Full chart: {chart}")
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Crystal healing: zodiac crystals
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
crystals = roxy.crystals.get_crystals_by_zodiac(sign="scorpio")
|
|
93
|
+
print(f"Scorpio crystals: {crystals}")
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### I Ching: daily reading
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
reading = roxy.iching.cast_daily_reading()
|
|
100
|
+
print(f"I Ching: {reading}")
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Domain reference
|
|
104
|
+
|
|
105
|
+
| Domain | Property | What it covers |
|
|
106
|
+
|--------|----------|----------------|
|
|
107
|
+
| Western Astrology | `roxy.astrology` | Natal charts, horoscopes, synastry, compatibility, transits, moon phases |
|
|
108
|
+
| Vedic Astrology | `roxy.vedic_astrology` | Birth charts, dashas, nakshatras, panchang, KP system, doshas, yogas |
|
|
109
|
+
| Tarot | `roxy.tarot` | Spreads, daily pulls, yes/no oracle, Celtic Cross, custom layouts |
|
|
110
|
+
| Numerology | `roxy.numerology` | Life path, expression, soul urge, personal year, karmic analysis |
|
|
111
|
+
| I Ching | `roxy.iching` | Hexagrams, trigrams, coin casting, daily readings |
|
|
112
|
+
| Crystals | `roxy.crystals` | Healing properties, zodiac/chakra pairings, birthstones, search |
|
|
113
|
+
| Angel Numbers | `roxy.angel_numbers` | Number meanings, pattern analysis, daily guidance |
|
|
114
|
+
| Dreams | `roxy.dreams` | Symbol dictionary, interpretations, daily guidance |
|
|
115
|
+
| Biorhythm | `roxy.biorhythm` | Physical, emotional, intellectual cycles, forecasts, compatibility |
|
|
116
|
+
| Location | `roxy.location` | City geocoding for birth chart coordinates |
|
|
117
|
+
| Usage | `roxy.usage` | API usage stats and subscription info |
|
|
118
|
+
|
|
119
|
+
## Async support
|
|
120
|
+
|
|
121
|
+
Every method has an `_async` suffix variant for use with asyncio:
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
import asyncio
|
|
125
|
+
from roxy_sdk import create_roxy
|
|
126
|
+
|
|
127
|
+
async def main():
|
|
128
|
+
roxy = create_roxy("your-api-key")
|
|
129
|
+
horoscope = await roxy.astrology.get_daily_horoscope_async(sign="aries")
|
|
130
|
+
card = await roxy.tarot.get_daily_card_async()
|
|
131
|
+
print(horoscope, card)
|
|
132
|
+
|
|
133
|
+
asyncio.run(main())
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Framework examples
|
|
137
|
+
|
|
138
|
+
The SDK is framework-agnostic. It works with Django, Flask, FastAPI, or any Python project.
|
|
139
|
+
|
|
140
|
+
### FastAPI
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
from fastapi import FastAPI
|
|
144
|
+
from roxy_sdk import create_roxy
|
|
145
|
+
|
|
146
|
+
app = FastAPI()
|
|
147
|
+
roxy = create_roxy("your-api-key")
|
|
148
|
+
|
|
149
|
+
@app.get("/horoscope/{sign}")
|
|
150
|
+
async def horoscope(sign: str):
|
|
151
|
+
return await roxy.astrology.get_daily_horoscope_async(sign=sign)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Flask
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
from flask import Flask, jsonify
|
|
158
|
+
from roxy_sdk import create_roxy
|
|
159
|
+
|
|
160
|
+
app = Flask(__name__)
|
|
161
|
+
roxy = create_roxy("your-api-key")
|
|
162
|
+
|
|
163
|
+
@app.route("/horoscope/<sign>")
|
|
164
|
+
def horoscope(sign):
|
|
165
|
+
return jsonify(roxy.astrology.get_daily_horoscope(sign=sign))
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Django (views.py)
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
from django.http import JsonResponse
|
|
172
|
+
from roxy_sdk import create_roxy
|
|
173
|
+
|
|
174
|
+
roxy = create_roxy("your-api-key")
|
|
175
|
+
|
|
176
|
+
def horoscope(request, sign):
|
|
177
|
+
return JsonResponse(roxy.astrology.get_daily_horoscope(sign=sign))
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Error handling
|
|
181
|
+
|
|
182
|
+
All API errors raise `RoxyAPIError` with `error` (human-readable message), `code` (machine-readable, stable), and `status_code` attributes:
|
|
183
|
+
|
|
184
|
+
```python
|
|
185
|
+
from roxy_sdk import create_roxy, RoxyAPIError
|
|
186
|
+
|
|
187
|
+
roxy = create_roxy("your-api-key")
|
|
188
|
+
|
|
189
|
+
try:
|
|
190
|
+
result = roxy.astrology.get_daily_horoscope(sign="invalid")
|
|
191
|
+
except RoxyAPIError as e:
|
|
192
|
+
print(f"Error: {e.error}")
|
|
193
|
+
print(f"Code: {e.code}")
|
|
194
|
+
print(f"Status: {e.status_code}")
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Error codes:
|
|
198
|
+
|
|
199
|
+
| Status | Code | When |
|
|
200
|
+
|--------|------|------|
|
|
201
|
+
| 400 | `validation_error` | Missing or invalid parameters |
|
|
202
|
+
| 401 | `api_key_required` | No API key provided |
|
|
203
|
+
| 401 | `invalid_api_key` | Key format invalid or tampered |
|
|
204
|
+
| 429 | `rate_limit_exceeded` | Monthly quota reached |
|
|
205
|
+
| 404 | `not_found` | Resource not found |
|
|
206
|
+
| 500 | `internal_error` | Server error |
|
|
207
|
+
|
|
208
|
+
## Environment variable
|
|
209
|
+
|
|
210
|
+
Store your API key in an environment variable for production use:
|
|
211
|
+
|
|
212
|
+
```python
|
|
213
|
+
import os
|
|
214
|
+
from roxy_sdk import create_roxy
|
|
215
|
+
|
|
216
|
+
roxy = create_roxy(os.environ["ROXY_API_KEY"])
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Configuration
|
|
220
|
+
|
|
221
|
+
`create_roxy` accepts optional parameters for advanced usage:
|
|
222
|
+
|
|
223
|
+
```python
|
|
224
|
+
roxy = create_roxy(
|
|
225
|
+
api_key="your-api-key",
|
|
226
|
+
base_url="https://roxyapi.com/api/v2", # default, override for local development
|
|
227
|
+
timeout=30.0, # request timeout in seconds (default: 30)
|
|
228
|
+
)
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
The client reuses HTTP connections for performance. For explicit cleanup, use the context manager:
|
|
232
|
+
|
|
233
|
+
```python
|
|
234
|
+
with create_roxy("your-api-key") as roxy:
|
|
235
|
+
horoscope = roxy.astrology.get_daily_horoscope(sign="aries")
|
|
236
|
+
# connections closed automatically
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Links
|
|
240
|
+
|
|
241
|
+
- [API Documentation](https://roxyapi.com/docs)
|
|
242
|
+
- [Interactive API Reference](https://roxyapi.com/api-reference)
|
|
243
|
+
- [Pricing](https://roxyapi.com/pricing)
|
|
244
|
+
- [MCP for AI Agents](https://roxyapi.com/docs/mcp)
|
|
245
|
+
- [Starter Apps](https://roxyapi.com/starters)
|
|
246
|
+
- [TypeScript SDK](https://www.npmjs.com/package/@roxyapi/sdk)
|
roxy_sdk-0.1.1/README.md
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# roxy-sdk
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/roxy-sdk/)
|
|
4
|
+
[](https://pypi.org/project/roxy-sdk/)
|
|
5
|
+
[](https://roxyapi.com/docs)
|
|
6
|
+
[](https://roxyapi.com/api-reference)
|
|
7
|
+
[](https://github.com/RoxyAPI/sdk-python/blob/main/LICENSE)
|
|
8
|
+
|
|
9
|
+
Python SDK for [RoxyAPI](https://roxyapi.com). Astrology, tarot, numerology, I Ching, crystals, angel numbers, dream interpretation, biorhythm, and more. One API key, 11 domains, 120+ endpoints.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install roxy-sdk
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quickstart
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from roxy_sdk import create_roxy
|
|
21
|
+
|
|
22
|
+
roxy = create_roxy("your-api-key")
|
|
23
|
+
horoscope = roxy.astrology.get_daily_horoscope(sign="aries")
|
|
24
|
+
print(horoscope)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Get your API key at [roxyapi.com/pricing](https://roxyapi.com/pricing). Free test keys available on the [interactive docs](https://roxyapi.com/api-reference).
|
|
28
|
+
|
|
29
|
+
## Recipes
|
|
30
|
+
|
|
31
|
+
### Dating app: zodiac compatibility
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
person1 = {"date": "1990-01-15", "time": "14:30:00", "latitude": 28.61, "longitude": 77.20}
|
|
35
|
+
person2 = {"date": "1992-07-22", "time": "09:00:00", "latitude": 19.07, "longitude": 72.87}
|
|
36
|
+
|
|
37
|
+
score = roxy.astrology.calculate_compatibility(person1=person1, person2=person2)
|
|
38
|
+
print(f"Compatibility: {score}")
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Wellness app: daily tarot card
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
card = roxy.tarot.get_daily_card()
|
|
45
|
+
print(f"Today: {card}")
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Journaling app: dream interpretation
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
symbol = roxy.dreams.get_dream_symbol(id="flying")
|
|
52
|
+
print(f"Flying in dreams: {symbol}")
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Numerology calculator: life path number
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
result = roxy.numerology.calculate_life_path(year=1990, month=1, day=15)
|
|
59
|
+
print(f"Life Path: {result}")
|
|
60
|
+
|
|
61
|
+
chart = roxy.numerology.generate_numerology_chart(full_name="Jane Smith", year=1990, month=1, day=15)
|
|
62
|
+
print(f"Full chart: {chart}")
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Crystal healing: zodiac crystals
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
crystals = roxy.crystals.get_crystals_by_zodiac(sign="scorpio")
|
|
69
|
+
print(f"Scorpio crystals: {crystals}")
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### I Ching: daily reading
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
reading = roxy.iching.cast_daily_reading()
|
|
76
|
+
print(f"I Ching: {reading}")
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Domain reference
|
|
80
|
+
|
|
81
|
+
| Domain | Property | What it covers |
|
|
82
|
+
|--------|----------|----------------|
|
|
83
|
+
| Western Astrology | `roxy.astrology` | Natal charts, horoscopes, synastry, compatibility, transits, moon phases |
|
|
84
|
+
| Vedic Astrology | `roxy.vedic_astrology` | Birth charts, dashas, nakshatras, panchang, KP system, doshas, yogas |
|
|
85
|
+
| Tarot | `roxy.tarot` | Spreads, daily pulls, yes/no oracle, Celtic Cross, custom layouts |
|
|
86
|
+
| Numerology | `roxy.numerology` | Life path, expression, soul urge, personal year, karmic analysis |
|
|
87
|
+
| I Ching | `roxy.iching` | Hexagrams, trigrams, coin casting, daily readings |
|
|
88
|
+
| Crystals | `roxy.crystals` | Healing properties, zodiac/chakra pairings, birthstones, search |
|
|
89
|
+
| Angel Numbers | `roxy.angel_numbers` | Number meanings, pattern analysis, daily guidance |
|
|
90
|
+
| Dreams | `roxy.dreams` | Symbol dictionary, interpretations, daily guidance |
|
|
91
|
+
| Biorhythm | `roxy.biorhythm` | Physical, emotional, intellectual cycles, forecasts, compatibility |
|
|
92
|
+
| Location | `roxy.location` | City geocoding for birth chart coordinates |
|
|
93
|
+
| Usage | `roxy.usage` | API usage stats and subscription info |
|
|
94
|
+
|
|
95
|
+
## Async support
|
|
96
|
+
|
|
97
|
+
Every method has an `_async` suffix variant for use with asyncio:
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
import asyncio
|
|
101
|
+
from roxy_sdk import create_roxy
|
|
102
|
+
|
|
103
|
+
async def main():
|
|
104
|
+
roxy = create_roxy("your-api-key")
|
|
105
|
+
horoscope = await roxy.astrology.get_daily_horoscope_async(sign="aries")
|
|
106
|
+
card = await roxy.tarot.get_daily_card_async()
|
|
107
|
+
print(horoscope, card)
|
|
108
|
+
|
|
109
|
+
asyncio.run(main())
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Framework examples
|
|
113
|
+
|
|
114
|
+
The SDK is framework-agnostic. It works with Django, Flask, FastAPI, or any Python project.
|
|
115
|
+
|
|
116
|
+
### FastAPI
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
from fastapi import FastAPI
|
|
120
|
+
from roxy_sdk import create_roxy
|
|
121
|
+
|
|
122
|
+
app = FastAPI()
|
|
123
|
+
roxy = create_roxy("your-api-key")
|
|
124
|
+
|
|
125
|
+
@app.get("/horoscope/{sign}")
|
|
126
|
+
async def horoscope(sign: str):
|
|
127
|
+
return await roxy.astrology.get_daily_horoscope_async(sign=sign)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Flask
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
from flask import Flask, jsonify
|
|
134
|
+
from roxy_sdk import create_roxy
|
|
135
|
+
|
|
136
|
+
app = Flask(__name__)
|
|
137
|
+
roxy = create_roxy("your-api-key")
|
|
138
|
+
|
|
139
|
+
@app.route("/horoscope/<sign>")
|
|
140
|
+
def horoscope(sign):
|
|
141
|
+
return jsonify(roxy.astrology.get_daily_horoscope(sign=sign))
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Django (views.py)
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
from django.http import JsonResponse
|
|
148
|
+
from roxy_sdk import create_roxy
|
|
149
|
+
|
|
150
|
+
roxy = create_roxy("your-api-key")
|
|
151
|
+
|
|
152
|
+
def horoscope(request, sign):
|
|
153
|
+
return JsonResponse(roxy.astrology.get_daily_horoscope(sign=sign))
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Error handling
|
|
157
|
+
|
|
158
|
+
All API errors raise `RoxyAPIError` with `error` (human-readable message), `code` (machine-readable, stable), and `status_code` attributes:
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
from roxy_sdk import create_roxy, RoxyAPIError
|
|
162
|
+
|
|
163
|
+
roxy = create_roxy("your-api-key")
|
|
164
|
+
|
|
165
|
+
try:
|
|
166
|
+
result = roxy.astrology.get_daily_horoscope(sign="invalid")
|
|
167
|
+
except RoxyAPIError as e:
|
|
168
|
+
print(f"Error: {e.error}")
|
|
169
|
+
print(f"Code: {e.code}")
|
|
170
|
+
print(f"Status: {e.status_code}")
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Error codes:
|
|
174
|
+
|
|
175
|
+
| Status | Code | When |
|
|
176
|
+
|--------|------|------|
|
|
177
|
+
| 400 | `validation_error` | Missing or invalid parameters |
|
|
178
|
+
| 401 | `api_key_required` | No API key provided |
|
|
179
|
+
| 401 | `invalid_api_key` | Key format invalid or tampered |
|
|
180
|
+
| 429 | `rate_limit_exceeded` | Monthly quota reached |
|
|
181
|
+
| 404 | `not_found` | Resource not found |
|
|
182
|
+
| 500 | `internal_error` | Server error |
|
|
183
|
+
|
|
184
|
+
## Environment variable
|
|
185
|
+
|
|
186
|
+
Store your API key in an environment variable for production use:
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
import os
|
|
190
|
+
from roxy_sdk import create_roxy
|
|
191
|
+
|
|
192
|
+
roxy = create_roxy(os.environ["ROXY_API_KEY"])
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Configuration
|
|
196
|
+
|
|
197
|
+
`create_roxy` accepts optional parameters for advanced usage:
|
|
198
|
+
|
|
199
|
+
```python
|
|
200
|
+
roxy = create_roxy(
|
|
201
|
+
api_key="your-api-key",
|
|
202
|
+
base_url="https://roxyapi.com/api/v2", # default, override for local development
|
|
203
|
+
timeout=30.0, # request timeout in seconds (default: 30)
|
|
204
|
+
)
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
The client reuses HTTP connections for performance. For explicit cleanup, use the context manager:
|
|
208
|
+
|
|
209
|
+
```python
|
|
210
|
+
with create_roxy("your-api-key") as roxy:
|
|
211
|
+
horoscope = roxy.astrology.get_daily_horoscope(sign="aries")
|
|
212
|
+
# connections closed automatically
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Links
|
|
216
|
+
|
|
217
|
+
- [API Documentation](https://roxyapi.com/docs)
|
|
218
|
+
- [Interactive API Reference](https://roxyapi.com/api-reference)
|
|
219
|
+
- [Pricing](https://roxyapi.com/pricing)
|
|
220
|
+
- [MCP for AI Agents](https://roxyapi.com/docs/mcp)
|
|
221
|
+
- [Starter Apps](https://roxyapi.com/starters)
|
|
222
|
+
- [TypeScript SDK](https://www.npmjs.com/package/@roxyapi/sdk)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["uv_build>=0.11.6,<0.12"]
|
|
3
|
+
build-backend = "uv_build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "roxy-sdk"
|
|
7
|
+
version = "0.1.1"
|
|
8
|
+
description = "Python SDK for RoxyAPI. Astrology, tarot, numerology, and more."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
dependencies = [
|
|
14
|
+
"httpx>=0.27.0",
|
|
15
|
+
]
|
|
16
|
+
authors = [
|
|
17
|
+
{ name = "RoxyAPI", email = "hi@roxyapi.com" },
|
|
18
|
+
]
|
|
19
|
+
keywords = ["astrology", "tarot", "numerology", "api", "sdk", "vedic", "horoscope"]
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Development Status :: 4 - Beta",
|
|
22
|
+
"Intended Audience :: Developers",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
"Typing :: Typed",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://roxyapi.com"
|
|
33
|
+
Repository = "https://github.com/RoxyAPI/sdk-python"
|
|
34
|
+
Documentation = "https://roxyapi.com/docs"
|
|
35
|
+
|
|
36
|
+
[tool.uv.build-backend]
|
|
37
|
+
module-name = "roxy_sdk"
|
|
38
|
+
module-root = "src"
|
|
39
|
+
source-exclude = ["**/_generated/**", "**/__pycache__/**"]
|
|
40
|
+
|
|
41
|
+
[dependency-groups]
|
|
42
|
+
dev = [
|
|
43
|
+
"pytest>=8.0",
|
|
44
|
+
"pytest-asyncio>=0.23",
|
|
45
|
+
"mypy>=1.9",
|
|
46
|
+
"ruff>=0.4",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[tool.ruff]
|
|
50
|
+
line-length = 100
|
|
51
|
+
target-version = "py310"
|
|
52
|
+
exclude = ["src/roxy_sdk/factory.py", "codegen.py"]
|
|
53
|
+
|
|
54
|
+
[tool.ruff.lint]
|
|
55
|
+
select = ["E", "F", "I", "UP", "B"]
|
|
56
|
+
|
|
57
|
+
[tool.mypy]
|
|
58
|
+
python_version = "3.10"
|
|
59
|
+
strict = true
|
|
60
|
+
|
|
61
|
+
[tool.pytest.ini_options]
|
|
62
|
+
asyncio_mode = "auto"
|
|
63
|
+
testpaths = ["tests"]
|