From d95abb15cb44b981ab4d2aa47ead989c295ce72d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Thu, 14 Mar 2019 10:01:14 +0100 Subject: [PATCH] fix: Do not send more than one email/day/hostname to the ticketing system. Fix #10 --- urlabuse/urlabuse.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/urlabuse/urlabuse.py b/urlabuse/urlabuse.py index 4d1d246..0796bc8 100644 --- a/urlabuse/urlabuse.py +++ b/urlabuse/urlabuse.py @@ -81,14 +81,18 @@ class Query(): day = date.today().isoformat() else: day = day.isoformat() - return self.cache.sismember(f'{day}_mails', url) + self.fex.decode(url) + host = self.fex.get_host() + return self.cache.sismember(f'{day}_mails', host) def set_mail_sent(self, url, day=None): if day is None: day = date.today().isoformat() else: day = day.isoformat() - return self.cache.sadd(f'{day}_mails', url) + self.fex.decode(url) + host = self.fex.get_host() + return self.cache.sadd(f'{day}_mails', host) def is_valid_url(self, url): cached = self._cache_get(url, 'valid')