krrishk22 commited on
Commit
7147b61
·
verified ·
1 Parent(s): abd3f75

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -70,11 +70,11 @@ def get_horoscope(sign: str, date: str = None, language: str = "EN") -> str:
70
  data = response.json()
71
 
72
  sign_upper = sign.upper()
73
- for item in data.get("data", []):
74
- if item.get("sign", "").upper() == sign_upper:
75
- prediction = item.get("prediction", "No prediction found.")
76
- used_date = params.get("day", "today")
77
- return f"Horoscope for {sign.capitalize()} on {used_date}:\n{prediction}"
78
 
79
  return f"No horoscope found for sign: {sign}"
80
 
 
70
  data = response.json()
71
 
72
  sign_upper = sign.upper()
73
+ sign_data = data.get(sign_upper)
74
+
75
+ if sign_data:
76
+ prediction = sign_data.get("Prediction", "No prediction found.")
77
+ return f"Horoscope for {sign.capitalize()} on {formatted_date}:\n{prediction}"
78
 
79
  return f"No horoscope found for sign: {sign}"
80