File size: 690 Bytes
c755297 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
def fill_prompt(prompt, json):
"""
Takes in a prompt and fills in the {key} with the corresponding value from the json KV pairs
"""
def build_filter(json_response):
filter = {}
days_list = json_response['Days']
# Days
if "[" in days_list:
days = str(days_list[0])
for i in range(len(days_list)-1):
days += ', '
days += str(days_list[i+1])
filter["days"] = days
# Units
units = json_response['Units']
if units != "":
filter["units"] = units
# Program
program = json_response['Program']
if program != "":
filter["program"] = program
# Time
return filter
|