Build Your App!
You're ready to build! Here's a complete example:
Copy
import requests
class VedikaClient:
"""Simple Vedika API client"""
def __init__(self, api_key=None):
# Use sandbox for development, production for live data
self.base_url = "https://api.vedika.io/sandbox" if not api_key else "https://api.vedika.io"
self.api_key = api_key
def _headers(self):
headers = {"Content-Type": "application/json"}
if self.api_key:
headers["x-api-key"] = self.api_key
return headers
def get_horoscope(self, sign, language="en"):
"""Get daily horoscope for a zodiac sign"""
response = requests.get(
f"{self.base_url}/sandbox/horoscope/daily",
params={"sign": sign, "language": language},
headers=self._headers()
)
return response.json()
def get_birth_chart(self, datetime_str, latitude, longitude, timezone="+05:30"):
"""Generate a birth chart (Kundali)"""
response = requests.post(
f"{self.base_url}/v2/astrology/birth-chart",
json={
"datetime": datetime_str,
"latitude": latitude,
"longitude": longitude,
"timezone": timezone
},
headers=self._headers()
)
return response.json()
def ask_ai(self, question, birth_details=None):
"""Ask the AI astrologer a question"""
payload = {"question": question}
if birth_details:
payload["birthDetails"] = birth_details
response = requests.post(
f"{self.base_url}/api/v1/astrology/query",
json=payload,
headers=self._headers()
)
return response.json()
# Usage
client = VedikaClient() # Sandbox mode (no API key)
# Get horoscope
horoscope = client.get_horoscope("leo")
print(horoscope["horoscope"])
# Ask AI (requires API key)
client = VedikaClient(api_key="vk_live_your_key_here")
answer = client.ask_ai(
"What does Mercury retrograde mean for my career?",
{"datetime": "1990-01-15T14:30:00", "latitude": 19.076, "longitude": 72.877, "timezone": "+05:30"}
)
print(answer["response"])