From b03e557e5f08ca9156869233639f5eefd67e1093 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Mon, 14 Nov 2022 08:24:29 -0500 Subject: fix #1: fails when accept header is absent Submitted via email --- coupons_web.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'coupons_web.py') diff --git a/coupons_web.py b/coupons_web.py index 16e89eb..bbd1177 100644 --- a/coupons_web.py +++ b/coupons_web.py @@ -55,7 +55,11 @@ def search(searchstring = ""): a = coupons.fetch_and_search(store = store, force = force, searchstring = searchstring, date = date, config = config) if len(a) > 2: # an empty a is "{}" which is a string?! results.append({store: json.loads(a)}) - accept = request.headers.get("Accept") + accept = [] + try: + accept = request.headers.get("Accept") + except: + pass from_js = True if request.headers.get("From") else False #print(f"DEBUG(web search): Accept only type {accept}") #print(f"DEBUG(web search): Results: {results}") -- cgit