support ip_country field

This commit is contained in:
2024-01-23 23:33:55 +01:00
parent 97c2b9ce8c
commit aa26e17e99
12 changed files with 147 additions and 60 deletions
+4 -3
View File
@@ -8,18 +8,19 @@ import requests
from db.mongo_manager import MONGO_STORE_MANAGER
from models.ReserveResultPojo import ReserveResultPojo, PublishType
from queue_message.CookiesPublisher import CookiesPublisher
from workers.proxies_constants import PROXY_LIST
from workers.proxies_constants import PROXY_LIST_FR
class Sender:
def __init__(self, cookie_str, cookiesPublisher: CookiesPublisher):
def __init__(self, cookie_str, cookiesPublisher: CookiesPublisher, proxy_to_use):
self.store_type = "random"
self.cookie = SimpleCookie()
self.cookiesPublisher = cookiesPublisher
# self.cookie_str = 'datadome=~pxdHFAvsQl2rvDrTzhPgCHxu~4TBcePTTE~Cy8Rgol6oMRc11gA02VRp0Z3uEDUszCjacubNu7vbfQCh27gz8RC10u_325pt_gsMmJh1ScGvOofVJiVAbEKvSEUjd82;policy=accepted;app.sig=PhjmDkq_dI49pADppDNKxpLe_G4;app=eyJmbGFzaCI6e30sImNhY2hlZmxhc2giOltdLCJjc3JmU2VjcmV0IjoiYnRodHNYU1lvdnl4RzVGakpGRDZsQ0JtIn0=;lang=fr;'
self.cookie_str = cookie_str
self._csrf = None
self.proxy_to_use = proxy_to_use
self.cookie.load(self.cookie_str)
def publish_message_to_queue(self, contact: ContactPojo, status: PublishType, url: str):
@@ -64,7 +65,7 @@ class Sender:
'passport_id': contact.passport, 'processing': 'on', 'cgu': 'on'}
print(data)
try:
proxy_to_use = random.choice(PROXY_LIST)
proxy_to_use = self.proxy_to_use
# proxy_to_use = PROXY_LIST[0]
print(proxy_to_use)
response = requests.post(url=url, proxies=proxy_to_use, verify=False, headers=headers, data=data,