diff --git a/regina/__init__.py b/regina/__init__.py index 611bd1e..0c15a23 100644 --- a/regina/__init__.py +++ b/regina/__init__.py @@ -1,7 +1,4 @@ """Gather analytics from nginx access logs and visualize them through generated images and a generated html""" # __package__ = 'regina' -# from db_operation import database, visualize, collect -import regina.db_operation -import regina.utility -print("running __init__.py") +from regina.db_operation import database, visualize, collect diff --git a/regina/db_operation/visualize.py b/regina/db_operation/visualize.py index 856306b..58a9156 100644 --- a/regina/db_operation/visualize.py +++ b/regina/db_operation/visualize.py @@ -321,9 +321,11 @@ def cleanup_referer(referer: str) -> str: domain = m.groups()[1].replace(subdomains, "") location = m.groups()[3] - assert(len(domain.split(".")) == 2) - referer = domain.split(".")[0] - if not settings["referer_ranking_ignore_tld"]: referer += "." + domain.split(".")[1] + if len(domain.split(".")) == 2: # if domain.tld + referer = domain.split(".")[0] + if not settings["referer_ranking_ignore_tld"]: referer += "." + domain.split(".")[1] + else: + referer = domain if not settings["referer_ranking_ignore_subdomain"]: referer = subdomains + referer if not settings["referer_ranking_ignore_subdomain"]: referer = subdomains + referer if not settings["referer_ranking_ignore_protocol"]: referer = protocol + "://" + referer