Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,14 +6,13 @@ st.write("Click the button below to get a random inspirational quote.")
|
|
| 6 |
|
| 7 |
if st.button("Generate Quote"):
|
| 8 |
try:
|
| 9 |
-
|
| 10 |
-
response = requests.get("https://api.quotable.io/random")
|
| 11 |
if response.status_code == 200:
|
| 12 |
-
data = response.json()
|
| 13 |
-
quote = data["
|
| 14 |
-
author = data["
|
| 15 |
st.success(f"💡 *{quote}* \n — {author}")
|
| 16 |
else:
|
| 17 |
st.error("⚠️ Could not fetch quote. Please try again later.")
|
| 18 |
except Exception as e:
|
| 19 |
-
st.error(f"⚠️ An error occurred: {e}")
|
|
|
|
| 6 |
|
| 7 |
if st.button("Generate Quote"):
|
| 8 |
try:
|
| 9 |
+
response = requests.get("https://zenquotes.io/api/random")
|
|
|
|
| 10 |
if response.status_code == 200:
|
| 11 |
+
data = response.json()[0]
|
| 12 |
+
quote = data["q"]
|
| 13 |
+
author = data["a"]
|
| 14 |
st.success(f"💡 *{quote}* \n — {author}")
|
| 15 |
else:
|
| 16 |
st.error("⚠️ Could not fetch quote. Please try again later.")
|
| 17 |
except Exception as e:
|
| 18 |
+
st.error(f"⚠️ An error occurred: {e}")
|