use DE queue to apply appointment request
This commit is contained in:
@@ -105,7 +105,7 @@ class AppointmentRequestSender(threading.Thread):
|
|||||||
self.contact_list = filter_contacts(self.contact_list)
|
self.contact_list = filter_contacts(self.contact_list)
|
||||||
# remove already booked contacts
|
# remove already booked contacts
|
||||||
random.shuffle(self.contact_list)
|
random.shuffle(self.contact_list)
|
||||||
if len(self.contact_list) > 0 and is_open() and _message_count > 100:
|
if len(self.contact_list) > 0 and is_open() and _message_count > 5:
|
||||||
captchaResultGetter = CaptchaResultGetter()
|
captchaResultGetter = CaptchaResultGetter()
|
||||||
print("contact number is {}".format(len(self.contact_list)))
|
print("contact number is {}".format(len(self.contact_list)))
|
||||||
self.contact_list = filter_contacts(self.contact_list)
|
self.contact_list = filter_contacts(self.contact_list)
|
||||||
|
|||||||
+22
-6
@@ -2,15 +2,16 @@ import datetime
|
|||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
from http.cookies import SimpleCookie
|
from http.cookies import SimpleCookie
|
||||||
|
from threading import Thread
|
||||||
|
|
||||||
from db.mongo_manager import MONGO_STORE_MANAGER
|
from db.mongo_manager import MONGO_STORE_MANAGER
|
||||||
from excel_reader import read_contacts
|
from excel_reader import read_contacts
|
||||||
from models.contact_pojo import ContactPojo
|
from models.contact_pojo import ContactPojo
|
||||||
from queue_message.CookiesPublisher import CookiesPublisher, REQUEST_DATA_QUEUE_DE
|
from queue_message.CookiesPublisher import CookiesPublisher, REQUEST_DATA_QUEUE_DE, REQUEST_DATA_QUEUE_TEST
|
||||||
from queue_message.appointmentrequestsender import AppointmentRequestSender, REQUEST_DATA_QUEUE
|
from queue_message.appointmentrequestsender import AppointmentRequestSender, REQUEST_DATA_QUEUE
|
||||||
from utiles import is_time_between
|
from utiles import is_time_between
|
||||||
from workers.captcha_result_getter import CaptchaResultGetter, HERMES_REGISTER
|
from workers.captcha_result_getter import CaptchaResultGetter, HERMES_REGISTER
|
||||||
from workers.proxies_constants import PROXY_LIST_DE, PROXY_LIST_FR
|
from workers.proxies_constants import PROXY_LIST_DE, PROXY_LIST_FR, MOBILE_PROXY_LIST_FR
|
||||||
from workers.sender import Sender
|
from workers.sender import Sender
|
||||||
|
|
||||||
IPFIY = 'http://api.ipify.org'
|
IPFIY = 'http://api.ipify.org'
|
||||||
@@ -71,15 +72,30 @@ def is_open():
|
|||||||
return is_time_between(datetime.time(10, 30), datetime.time(19, 00))
|
return is_time_between(datetime.time(10, 30), datetime.time(19, 00))
|
||||||
|
|
||||||
|
|
||||||
def send_appointment_request(message_queue_name, contacts_file_path):
|
count = 0
|
||||||
|
|
||||||
|
|
||||||
|
def send_appointment_request(message_queue_name, _contact_list):
|
||||||
|
global count
|
||||||
|
count = count + 1
|
||||||
_cookiesPublisher = CookiesPublisher(queue_name=message_queue_name)
|
_cookiesPublisher = CookiesPublisher(queue_name=message_queue_name)
|
||||||
_cookiesPublisher.set_up_connection()
|
_cookiesPublisher.set_up_connection()
|
||||||
contact_list = read_contacts(contacts_file_path)
|
receiver = AppointmentRequestSender(sub_contact_list=_contact_list, proxy_to_use_list=MOBILE_PROXY_LIST_FR,
|
||||||
receiver = AppointmentRequestSender(sub_contact_list=contact_list, proxy_to_use_list=PROXY_LIST_FR,
|
|
||||||
queue_name=message_queue_name,
|
queue_name=message_queue_name,
|
||||||
cookiesPublisher=_cookiesPublisher)
|
cookiesPublisher=_cookiesPublisher)
|
||||||
|
print("count is " + str(count))
|
||||||
receiver.run()
|
receiver.run()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
send_appointment_request(REQUEST_DATA_QUEUE, '~/Desktop/yahoo_aol_valid_26-1.xlsx')
|
contacts_file_path = '~/Desktop/contact_list_2024-03-09.xlsx'
|
||||||
|
_contact_list = read_contacts(contacts_file_path)
|
||||||
|
_segment_number = 4
|
||||||
|
for i in range(0, _segment_number):
|
||||||
|
print(i)
|
||||||
|
_step = int(len(_contact_list) / _segment_number)
|
||||||
|
_sublist = _contact_list[i:_step * (i + 1)]
|
||||||
|
print(_sublist[0])
|
||||||
|
print(_sublist[-1])
|
||||||
|
_thread1 = Thread(target=send_appointment_request, args=(REQUEST_DATA_QUEUE_DE, _sublist))
|
||||||
|
_thread1.start()
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ class LinkValidator(threading.Thread):
|
|||||||
for con in self.link_to_validate_list:
|
for con in self.link_to_validate_list:
|
||||||
# if not is_already_sent(con):
|
# if not is_already_sent(con):
|
||||||
print(con.email)
|
print(con.email)
|
||||||
|
self.proxy_to_use = random.choice(PROXY_LIST_FR)
|
||||||
can_continue = self.send_request(con)
|
can_continue = self.send_request(con)
|
||||||
if can_continue == RequestResult.BLOCKED:
|
if can_continue == RequestResult.BLOCKED:
|
||||||
print("cannot continue, blocked, then skip")
|
print("cannot continue, blocked, then skip")
|
||||||
@@ -151,9 +152,11 @@ def validate_with_FR_ip():
|
|||||||
for _l in _link_list_to_click:
|
for _l in _link_list_to_click:
|
||||||
print(_l.ip_country)
|
print(_l.ip_country)
|
||||||
_fr_proxy_to_use = random.choice(PROXY_LIST_FR)
|
_fr_proxy_to_use = random.choice(PROXY_LIST_FR)
|
||||||
|
# random.shuffle(_link_list_to_click)
|
||||||
receiver = LinkValidator(link_to_validate_list=_link_list_to_click, cookiesPublisher=cookiesPublisher,
|
receiver = LinkValidator(link_to_validate_list=_link_list_to_click, cookiesPublisher=cookiesPublisher,
|
||||||
proxy_to_use=_fr_proxy_to_use,
|
proxy_to_use=_fr_proxy_to_use,
|
||||||
queue_to_listen=_queue_name, ip_country="FR", limit=40)
|
queue_to_listen=_queue_name, ip_country="FR", limit=50)
|
||||||
|
print("will connect to queue")
|
||||||
receiver.set_up_connection()
|
receiver.set_up_connection()
|
||||||
receiver.listen_to_queue(receiver.on_message)
|
receiver.listen_to_queue(receiver.on_message)
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ FR_PROXY_MOBILE_2 = {
|
|||||||
'http': 'http://d707052c-197322:21h64jwobv@190.2.149.148:18220',
|
'http': 'http://d707052c-197322:21h64jwobv@190.2.149.148:18220',
|
||||||
'https': 'http://d707052c-197322:21h64jwobv@190.2.149.148:18220',
|
'https': 'http://d707052c-197322:21h64jwobv@190.2.149.148:18220',
|
||||||
}
|
}
|
||||||
|
FR_PROXY_MOBILE_3 = {
|
||||||
|
'http': 'http://11797317-mobile-country-FR:nv958134x@190.2.151.110:14046',
|
||||||
|
'https': 'http://11797317-mobile-country-FR:nv958134x@190.2.151.110:14046',
|
||||||
|
}
|
||||||
|
|
||||||
FR_PROXY_RES = {
|
FR_PROXY_RES = {
|
||||||
'http': 'http://7090876-res-country-FR:1tvt4pavvi@185.2.81.74:13378',
|
'http': 'http://7090876-res-country-FR:1tvt4pavvi@185.2.81.74:13378',
|
||||||
@@ -29,6 +33,20 @@ FR_PROXY_RES_2 = {
|
|||||||
'http': 'http://10488120-res-country-FR:k94fsbn9a@217.23.6.161:11287',
|
'http': 'http://10488120-res-country-FR:k94fsbn9a@217.23.6.161:11287',
|
||||||
'https': 'http://10488120-res-country-FR:k94fsbn9a@217.23.6.161:11287'
|
'https': 'http://10488120-res-country-FR:k94fsbn9a@217.23.6.161:11287'
|
||||||
}
|
}
|
||||||
|
FR_PROXY_RES_4 = {
|
||||||
|
'http': 'http://11798886-res-country-FR:2gf56mjkw9@194.88.106.169:11262',
|
||||||
|
'https': 'http://11798886-res-country-FR:2gf56mjkw9@194.88.106.169:11262'
|
||||||
|
}
|
||||||
|
FR_PROXY_RES_OXY = {
|
||||||
|
'http': 'http://customer-rendezvous-cc-FR:Rdv202220212023@pr.oxylabs.io:7777',
|
||||||
|
'https': 'http://customer-rendezvous-cc-FR:Rdv202220212023@pr.oxylabs.io:7777'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FR_PROXY_MOB_OXY = {
|
||||||
|
'http': 'http://customer-rendezvousmob-cc-FR:Rdv202220212023@pr.oxylabs.io:7777',
|
||||||
|
'https': 'http://customer-rendezvousmob-cc-FR:Rdv202220212023@pr.oxylabs.io:7777'
|
||||||
|
}
|
||||||
|
|
||||||
DE_PROXY_MOBILE = {
|
DE_PROXY_MOBILE = {
|
||||||
'http': 'http://8153587-mobile-country-DE:jp50x9jmo@194.88.106.169:11842',
|
'http': 'http://8153587-mobile-country-DE:jp50x9jmo@194.88.106.169:11842',
|
||||||
@@ -38,9 +56,15 @@ DE_PROXY_RES = {
|
|||||||
'http': 'http://8254565-res-country-DE:1st57izbhe@185.21.60.181:14648',
|
'http': 'http://8254565-res-country-DE:1st57izbhe@185.21.60.181:14648',
|
||||||
'https': 'http://8254565-res-country-DE:1st57izbhe@185.21.60.181:14648'
|
'https': 'http://8254565-res-country-DE:1st57izbhe@185.21.60.181:14648'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# FR_PROXY_MOBILE
|
# FR_PROXY_MOBILE
|
||||||
# FR_PROXY_RES
|
# FR_PROXY_RES
|
||||||
# PROXY_LIST = [FR_PROXY_MOBILE, FR_PROXY_RES, DE_PROXY_RES, DE_PROXY_MOBILE, ES_PROXY_MOBILE, IT_PROXY_MOBILE]
|
# PROXY_LIST = [FR_PROXY_MOBILE, FR_PROXY_RES, DE_PROXY_RES, DE_PROXY_MOBILE, ES_PROXY_MOBILE, IT_PROXY_MOBILE]
|
||||||
PROXY_LIST_FR = [FR_PROXY_MOBILE_2, FR_PROXY_MOBILE, FR_PROXY_RES_2]
|
# PROXY_LIST_FR = [FR_PROXY_MOBILE_2, FR_PROXY_MOBILE, FR_PROXY_RES, FR_PROXY_RES_4, FR_PROXY_RES_2]
|
||||||
# PROXY_LIST = [FR_PROXY_MOBILE, FR_PROXY_RES]
|
# PROXY_LIST_FR = [FR_PROXY_RES_OXY, FR_PROXY_MOBILE_3]
|
||||||
|
PROXY_LIST_FR = [FR_PROXY_RES_OXY]
|
||||||
|
MOBILE_PROXY_LIST_FR = [FR_PROXY_MOB_OXY]
|
||||||
|
# PROXY_LIST = [FR_PROXY_MOBILE, FR_
|
||||||
|
# PROXY_RES]
|
||||||
PROXY_LIST_DE = [DE_PROXY_RES, DE_PROXY_MOBILE]
|
PROXY_LIST_DE = [DE_PROXY_RES, DE_PROXY_MOBILE]
|
||||||
|
|||||||
+1
-1
@@ -86,7 +86,7 @@ class Sender:
|
|||||||
print("will publish to queue {}".format(new_coolies_str))
|
print("will publish to queue {}".format(new_coolies_str))
|
||||||
# upload the cookie to queue
|
# upload the cookie to queue
|
||||||
self.cookiesPublisher.publish_body(new_coolies_str)
|
self.cookiesPublisher.publish_body(new_coolies_str)
|
||||||
self.cookie_str = new_coolies_str
|
# self.cookie_str = new_coolies_str
|
||||||
return RequestResult.SUCCESS
|
return RequestResult.SUCCESS
|
||||||
else:
|
else:
|
||||||
return RequestResult.BLOCKED
|
return RequestResult.BLOCKED
|
||||||
|
|||||||
Reference in New Issue
Block a user