Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -42,10 +42,12 @@ def get_page_in_quran(page: int) -> str:
|
|
| 42 |
try:
|
| 43 |
api_url = f"http://api.alquran.cloud/v1/page/{page}/en.asad"
|
| 44 |
# Get contents of the page
|
| 45 |
-
|
| 46 |
if response.status_code == 200:
|
| 47 |
data = response.json()
|
| 48 |
-
|
|
|
|
|
|
|
| 49 |
except Exception as e:
|
| 50 |
return f"Error fetching page '{page}' of the quran: {str(e)}"
|
| 51 |
|
|
|
|
| 42 |
try:
|
| 43 |
api_url = f"http://api.alquran.cloud/v1/page/{page}/en.asad"
|
| 44 |
# Get contents of the page
|
| 45 |
+
response = requests.get(api_url)
|
| 46 |
if response.status_code == 200:
|
| 47 |
data = response.json()
|
| 48 |
+
return data.get("data", f"No data available for page: {page} in the quran")
|
| 49 |
+
else:
|
| 50 |
+
return f"Error: Unable to fetch page: {page} in the quran"
|
| 51 |
except Exception as e:
|
| 52 |
return f"Error fetching page '{page}' of the quran: {str(e)}"
|
| 53 |
|