Update app.py
Browse files
app.py
CHANGED
|
@@ -53,11 +53,11 @@ def get_random_joke(type: str) -> str:
|
|
| 53 |
|
| 54 |
if not type or type in types:
|
| 55 |
if isinstance(joke, list) and len(joke) > 0:
|
| 56 |
-
return f"- {joke[0][
|
| 57 |
else:
|
| 58 |
-
return f"- {joke[
|
| 59 |
|
| 60 |
-
return f"Type not found. Getting a random joke. (available types: {types})\n- {joke[
|
| 61 |
|
| 62 |
except requests.exceptions.Timeout:
|
| 63 |
return "The request timed out. Please try again later or check the URL."
|
|
|
|
| 53 |
|
| 54 |
if not type or type in types:
|
| 55 |
if isinstance(joke, list) and len(joke) > 0:
|
| 56 |
+
return f"- {joke[0]['setup']}\n- {joke[0]['punchline']}"
|
| 57 |
else:
|
| 58 |
+
return f"- {joke['setup']}\n- {joke['punchline']}"
|
| 59 |
|
| 60 |
+
return f"Type not found. Getting a random joke. (available types: {types})\n- {joke['setup']}\n- {joke['punchline']}"
|
| 61 |
|
| 62 |
except requests.exceptions.Timeout:
|
| 63 |
return "The request timed out. Please try again later or check the URL."
|