Skip to content

Commit

Permalink
now the rest of Hypercane will not work unless the user specifies a c…
Browse files Browse the repository at this point in the history
…ache #57
  • Loading branch information
shawnmjones committed Sep 18, 2021
1 parent 42f2c81 commit 6fcf59c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion hypercane/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@

module_logger = logging.getLogger("hypercane.utils")

class HypercaneStartUpError(Exception):
pass

def get_web_session(cache_storage=None):

proxies = None
Expand All @@ -43,6 +46,8 @@ def get_web_session(cache_storage=None):

if cache_storage is not None:

module_logger.info("creating HTTP session with cached storage at {}".format(cache_storage))

o = urlparse(cache_storage)
if o.scheme == "mongodb":
# these requests-cache internals gymnastics are necessary
Expand All @@ -55,7 +60,7 @@ def get_web_session(cache_storage=None):
else:
session = CachedSession(cache_name=cache_storage, extension='')
else:
session = Session()
raise HypercaneStartUpError("Caching is required to use Hypercane. Please specify a MongoDB or SQLite database for caching through the -cs argument or HC_CACHE_STORAGE environment variable. If you are seeing this message in the Hypercane GUI, please notify your system administrator.")

retry = Retry(
total=10,
Expand Down

0 comments on commit 6fcf59c

Please sign in to comment.