mbalvi commited on
Commit
b8b8615
·
verified ·
1 Parent(s): 9c7ca18

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
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
- # Using the Quotable API
10
- response = requests.get("https://api.quotable.io/random")
11
  if response.status_code == 200:
12
- data = response.json()
13
- quote = data["content"]
14
- author = data["author"]
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}")