Removed useless init.py and moved the jokes api token in the secrets

This commit is contained in:
Mathieu B 2021-07-27 16:38:51 +02:00
parent ca91994975
commit 17acd5e05d
4 changed files with 4 additions and 3 deletions

View File

View File

@ -1,6 +1,6 @@
import requests as requests import requests as requests
from utils import languages_utils from utils import languages_utils, config_utils
def tell_me_a_joke(): def tell_me_a_joke():
@ -9,11 +9,12 @@ def tell_me_a_joke():
# french jokes # french jokes
if languages_utils.get_language().startswith("fr-"): if languages_utils.get_language().startswith("fr-"):
# the token used might be revoked at any time, please register on www.blagues-api.fr and replace it
# please register on www.blagues-api.fr and set a token in your secret
response = requests.get( response = requests.get(
'https://www.blagues-api.fr/api/random', 'https://www.blagues-api.fr/api/random',
headers={ headers={
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiNzA4OTcyNzQwOTQ5ODM1ODI2IiwibGltaXQiOjEwMCwia2V5IjoiYmZlUVBSb2xuY2FleHBHc2taRU90VkdKOGxhdWZsZVRSMFJadnR3QXV3c056djdpYlkiLCJjcmVhdGVkX2F0IjoiMjAyMS0wNS0yOVQxNDoyMjo0MCswMDowMCIsImlhdCI6MTYyMjI5ODE2MH0.6VxH_dTdJSddhHoYOtdQl0j9WC3lzXjUujUio5U09Jg' 'Authorization': 'Bearer ' + config_utils.get_in_secret('JOKES_FRENCH_API_TOKEN')
} }
) )