[MTELESILA-5]add request_url_json

This commit is contained in:
Nicolas Selva 2023-01-25 12:12:45 +01:00
parent 962987ac45
commit 6bab9f5fb9
1 changed files with 12 additions and 0 deletions

View File

@ -172,6 +172,18 @@ def liste_type_rdv_nombres_personnes(value, arg):
return [x for x in liste["data"] if arg in x["text"]]
@register.filter
def request_url_json(url):
"""
Permet de get les données d'une url JSON
url : (str) url du json
return : {'data':[]}
"""
headers = {"Accept": "application/json"}
return requests.get(url, headers=headers).json()
@register.filter
def stop_monday_for_we(value):
"""