can get le type jsdata

This commit is contained in:
2024-03-19 13:51:44 +01:00
parent 4f48fc0366
commit 53ea721cb6
10 changed files with 245 additions and 157 deletions
+5 -3
View File
@@ -8,6 +8,7 @@ import requests
from db.mongo_manager import MONGO_STORE_MANAGER
from models.ReserveResultPojo import ReserveResultPojo, PublishType
from models.jsdata_pojo import JsDataPojo
from models.result_pojo import RequestResult
from queue_message.CookiesPublisher import CookiesPublisher
from workers.proxies_constants import PROXY_LIST_FR
@@ -46,7 +47,7 @@ class Sender:
def get_csrf(self):
pass
def send_request(self, url, contact: ContactPojo, csrf: str = None) -> RequestResult:
def send_request(self, url, js_data: JsDataPojo, contact: ContactPojo, csrf: str = None) -> RequestResult:
if csrf is None:
if self._csrf is None:
_csrf = '8Bs2dBwb-nHONOzo9Tei2CcMZglEfsRqUz8E'
@@ -56,7 +57,7 @@ class Sender:
self._csrf = csrf
_csrf = csrf
headers = {'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Mobile Safari/537.36',
'User-Agent': js_data.ua,
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8',
'Cookie': self.cookie_str, 'Referer': 'https://rendezvousparis.hermes.com/client/register',
'Sec-Fetch-Mode': 'navigate',
@@ -67,9 +68,9 @@ class Sender:
'phone_country': "FR", 'phone_number': "+33 " + contact.phone, 'email': contact.mail,
'passport_id': contact.passport, 'processing': 'on', 'cgu': 'on'}
print(data)
print("send request with cookie:{}".format(self.cookie_str))
try:
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,
timeout=15)
@@ -93,6 +94,7 @@ class Sender:
# self.cookie_str = new_coolies_str
return RequestResult.SUCCESS
else:
print(response.text)
return RequestResult.BLOCKED
except Exception as Error:
print(Error)