diff --git a/app/services/location/csbs.py b/app/services/location/csbs.py index 444ebad6..30d1f6cf 100644 --- a/app/services/location/csbs.py +++ b/app/services/location/csbs.py @@ -11,6 +11,7 @@ from ...location.csbs import CSBSLocation from ...utils import httputils from . import LocationService +from ...utils.baseurls import BaseUrl LOGGER = logging.getLogger("services.location.csbs") @@ -32,7 +33,7 @@ async def get(self, loc_id): # pylint: disable=arguments-differ # Base URL for fetching data -BASE_URL = "https://facts.csbs.org/covid-19/covid19_county.csv" +BASE_URL = BaseUrl.CSBS @cached(cache=TTLCache(maxsize=1, ttl=1800)) @@ -100,3 +101,4 @@ async def get_locations(): # Return the locations. return locations + diff --git a/app/utils/baseurls.py b/app/utils/baseurls.py new file mode 100644 index 00000000..ccebf743 --- /dev/null +++ b/app/utils/baseurls.py @@ -0,0 +1,10 @@ +import enum + +class BaseUrl(str, enum.Enum): + """ + A base url available for retrieving data. + """ + + JHU = "https://raw.githubusercontent.com/CSSEGISandData/2019-nCoV/master/csse_covid_19_data/csse_covid_19_time_series/" + CSBS = "https://facts.csbs.org/covid-19/covid19_county.csv" + NYT = "https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv"