34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
import random
|
|
|
|
from db.mongo_manager import MONGO_STORE_MANAGER
|
|
from queue_message.CookiesPublisher import REQUEST_DATA_QUEUE_DE, CookiesPublisher
|
|
from workers.link_validator import LinkValidator
|
|
from workers.proxies_constants import PROXY_LIST_DE
|
|
|
|
|
|
def validate_with_DE_ip():
|
|
_queue_name = REQUEST_DATA_QUEUE_DE
|
|
link_list = MONGO_STORE_MANAGER.get_links_to_validate()
|
|
cookiesPublisher = CookiesPublisher(queue_name=_queue_name)
|
|
cookiesPublisher.set_up_connection()
|
|
print("filter links with ip_country")
|
|
_link_list_to_click = []
|
|
for _link in link_list:
|
|
if _link.ip_country == "DE":
|
|
_link_list_to_click.append(_link)
|
|
for _l in _link_list_to_click:
|
|
print(_l.ip_country)
|
|
# else:
|
|
# print(_link.ip_country)
|
|
_de_proxy_to_use = random.choice(PROXY_LIST_DE)
|
|
receiver = LinkValidator(link_to_validate_list=_link_list_to_click, cookiesPublisher=cookiesPublisher,
|
|
proxy_to_use=_de_proxy_to_use,
|
|
queue_to_listen=_queue_name, ip_country="DE")
|
|
receiver.set_up_connection()
|
|
receiver.listen_to_queue(receiver.on_message)
|
|
pass
|
|
|
|
|
|
if __name__ == '__main__':
|
|
validate_with_DE_ip()
|