From 0843f1ae31ef7fbf555b6683f20967450fe93ef1 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Mon, 26 Sep 2022 14:24:11 -0400 Subject: support nested items? --- coupons.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'coupons.py') diff --git a/coupons.py b/coupons.py index 0356bfb..7ce2411 100755 --- a/coupons.py +++ b/coupons.py @@ -196,7 +196,16 @@ def parse_coupons(inputobject, searchstring = None): rcat = c["name"] #response[rgroup][rcat] = [] for i in c["items"]: - text = i["html"] + print(f"item = {i}") + try: + text = i["html"] + except: + text = i["name"] + add_text = "" + for h in i["items"] if "items" in i else []: + add_text += "
  • " + str(h["html"] if "html" in h else "") + str(h["notes"] if "notes" in h else "") + "
  • " + if "" != add_text: + text += "" if "notes" in i and i["notes"] != "": text = text + " " + i["notes"] + "" #if searchstring in text.lower(): -- cgit