From 6e68c350f130cc505b324cb7f6b702bf8f43c0a9 Mon Sep 17 00:00:00 2001 From: Justin Date: Mon, 17 Jul 2023 14:38:58 +0800 Subject: [PATCH] safe setting added to jokes --- database_caller.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/database_caller.py b/database_caller.py index daa21c1..36e2e22 100755 --- a/database_caller.py +++ b/database_caller.py @@ -817,7 +817,7 @@ def updateJokes(api_key, logf): with open('csv/jokes_settings.json', 'r') as f: jokes_settings = json.load(f) except: - jokes_settings = {"feature": "Jokes", "speed": "medium", "speed2": "medium", "animation": "up", "title": true, "categories": ["Any"], "blacklist": [], "amount": "5", "jokes": []} + jokes_settings = {"feature": "Jokes", "speed": "medium", "speed2": "medium", "animation": "up", "title": True, "safe": True, "categories": ["Any"], "blacklist": [], "amount": "5", "jokes": []} try: if 'Any' in jokes_settings['categories']: categories = 'Any' @@ -830,6 +830,8 @@ def updateJokes(api_key, logf): joke_url = 'https://v2.jokeapi.dev/joke/'+categories+'?amount='+amount if blacklist != '': joke_url = 'https://v2.jokeapi.dev/joke/'+categories+ '?blacklistFlags=' + blacklist + '&amount='+amount + if jokes_settings['safe']: + joke_url += '&safe-mode' get_jokes = requests.get(joke_url) all_jokes = get_jokes.json()