File size: 637 Bytes
96a5ab9
 
 
c695989
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
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)}