check black list before send request

This commit is contained in:
Lei PAN
2022-07-06 18:08:00 +02:00
parent d495308a1f
commit 2a339be86e
4 changed files with 47 additions and 7 deletions
+16
View File
@@ -0,0 +1,16 @@
import time
from src import params
from src.pojo.contact_pojo import ContactPojo
SEVEN_DAYS_IN_S = 7 * 24 * 3600
def can_send_request(contact: ContactPojo) -> bool:
black_list = params.mongo_store_manager.get_blacklist_contacts()
for black_contact in black_list:
if contact.mail == black_contact.mail:
# check date
return black_contact.update_at_in_s + SEVEN_DAYS_IN_S < time.time()
return True