Skip to content

armgit / mwmbl

Public Imported from GitHub
0

An open source, non-profit web search engine

add check for api key

thiswillbeyourgithub9a9ceaac28ba
diff --git a/mwmbl/crawler/env_vars.py b/mwmbl/crawler/env_vars.py
index c12db01..b64c5db 100644
--- a/mwmbl/crawler/env_vars.py
+++ b/mwmbl/crawler/env_vars.py
@@ -16,7 +16,8 @@ CRAWL_DELAY_SECONDS = float(os.environ.get("CRAWL_DELAY_SECONDS", "0.0"))
REDIS_URL = os.environ.get("REDIS_URL", "redis://127.0.0.1:6379")
# API configuration
-MWMBL_API_KEY = os.environ["MWMBL_API_KEY"]
+MWMBL_API_KEY = os.environ.get("MWMBL_API_KEY", "")
+assert MWMBL_API_KEY.strip(), "An environment variable MWMBL_API_KEY must be set to run the crawler"
# Contact information configuration - required for responsible crawling
MWMBL_CONTACT_INFO = os.environ.get("MWMBL_CONTACT_INFO", "[email protected]")