check black list before send request
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user