diff options
author | B. Stack <bgstack15@gmail.com> | 2022-11-14 08:24:29 -0500 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-11-14 08:24:29 -0500 |
commit | b03e557e5f08ca9156869233639f5eefd67e1093 (patch) | |
tree | b4ced0810c1adb32eab8efee50d913d44e2d8761 /coupons_web.py | |
parent | support nested items? (diff) | |
download | coupons-b03e557e5f08ca9156869233639f5eefd67e1093.tar.gz coupons-b03e557e5f08ca9156869233639f5eefd67e1093.tar.bz2 coupons-b03e557e5f08ca9156869233639f5eefd67e1093.zip |
fix #1: fails when accept header is absent
Submitted via email
Diffstat (limited to 'coupons_web.py')
-rw-r--r-- | coupons_web.py | 6 |
1 files changed, 5 insertions, 1 deletions
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}") |