From 8a141e050a58362f59f0874c35e0e0f086ea0ce7 Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Sun, 24 Jan 2021 19:51:13 -0800 Subject: [PATCH] Dont error if vaccination data isnt available --- app/corona.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/corona.py b/app/corona.py index 4f75a57e..b37a67e3 100644 --- a/app/corona.py +++ b/app/corona.py @@ -80,7 +80,10 @@ def get_vaccination_data(location): cols = [ele.text.strip() for ele in cols] data.append([ele for ele in cols if ele]) # Get rid of empty values - state_name, num_vaccinated, population, percent_vaccinated = list(filter(lambda x: x[0] == location, data))[0] + try: + state_name, num_vaccinated, population, percent_vaccinated = list(filter(lambda x: x[0] == location, data))[0] + except Exception: + return "Not available for %s" % location return percent_vaccinated def parse_message(message):