ai-astro / astrology.py
Prak2005's picture
Update astrology.py
c695989 verified
raw
history blame contribute delete
637 Bytes
import swisseph as swe
def get_astrological_details(date_of_birth, time_of_birth, place_of_birth):
"""Faster astrology calculations"""
try:
year, month, day = map(int, date_of_birth.split('-'))
hour, minute = map(int, time_of_birth.split(':'))
jd = swe.julday(year, month, day, hour + minute / 60.0)
planets = ['Sun', 'Moon', 'Mars']
planet_positions = {planet: round(swe.calc_ut(jd, i)[0][0], 2) for i, planet in enumerate(planets)}
return {"planet_positions": planet_positions, "prediction": "Fast astrology results."}
except Exception as e:
return {"error": str(e)}