safe setting added to jokes
This commit is contained in:
parent
8e5e100859
commit
6e68c350f1
@ -817,7 +817,7 @@ def updateJokes(api_key, logf):
|
|||||||
with open('csv/jokes_settings.json', 'r') as f:
|
with open('csv/jokes_settings.json', 'r') as f:
|
||||||
jokes_settings = json.load(f)
|
jokes_settings = json.load(f)
|
||||||
except:
|
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:
|
try:
|
||||||
if 'Any' in jokes_settings['categories']:
|
if 'Any' in jokes_settings['categories']:
|
||||||
categories = 'Any'
|
categories = 'Any'
|
||||||
@ -830,6 +830,8 @@ def updateJokes(api_key, logf):
|
|||||||
joke_url = 'https://v2.jokeapi.dev/joke/'+categories+'?amount='+amount
|
joke_url = 'https://v2.jokeapi.dev/joke/'+categories+'?amount='+amount
|
||||||
if blacklist != '':
|
if blacklist != '':
|
||||||
joke_url = 'https://v2.jokeapi.dev/joke/'+categories+ '?blacklistFlags=' + blacklist + '&amount='+amount
|
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)
|
get_jokes = requests.get(joke_url)
|
||||||
all_jokes = get_jokes.json()
|
all_jokes = get_jokes.json()
|
||||||
|
Loading…
Reference in New Issue
Block a user