define PROXY_TIMEOUT_S
This commit is contained in:
@@ -14,13 +14,13 @@ from models.jsdata_pojo import JsDataPojo
|
||||
from models.result_pojo import RequestResult
|
||||
from utils.get_only_datadome_cookies import get_datadome_cookies, get_app_cookies, get_lang_cookies, \
|
||||
retain_only_dataome_cookies
|
||||
from workers.proxy_constants import PROXY_TIMEOUT_S
|
||||
|
||||
API_KEY = "d66aaf490d8aa424a5175e1fbd1aadea"
|
||||
|
||||
HOST_ADDRESS = "https://api.2captcha.com/createTask"
|
||||
HERMES_REGISTER = "https://rendezvousparis.hermes.com/client/register"
|
||||
|
||||
|
||||
class CaptchaResultGetter:
|
||||
|
||||
def __init__(self):
|
||||
@@ -51,7 +51,7 @@ class CaptchaResultGetter:
|
||||
print(proxy_to_use)
|
||||
try:
|
||||
response = requests.get(url=HERMES_REGISTER, headers=headers, verify=False, proxies=proxy_to_use,
|
||||
timeout=15)
|
||||
timeout=PROXY_TIMEOUT_S)
|
||||
print(response.status_code)
|
||||
if response.status_code == 200:
|
||||
print(response.text)
|
||||
@@ -94,7 +94,7 @@ class CaptchaResultGetter:
|
||||
raw_data = self.get_le_type_raw_data(old_valid_cookie=old_valid_cookie, js_le_type_data=js_le_type_data)
|
||||
response = requests.post(url="https://d.digital.hermes/js/", headers=headers, verify=False,
|
||||
data=raw_data,
|
||||
proxies=proxy_to_use, timeout=15)
|
||||
proxies=proxy_to_use, timeout=PROXY_TIMEOUT_S)
|
||||
# print(response.status_code)
|
||||
if response.status_code == 200:
|
||||
print(response.text)
|
||||
@@ -149,7 +149,7 @@ class CaptchaResultGetter:
|
||||
response = requests.post(url="https://d.digital.hermes/js/", headers=headers, verify=False,
|
||||
data=self.get_ch_raw_data_from_js_data(js_data=js_data,
|
||||
old_valid_cookie=_cookies_to_use),
|
||||
proxies=proxy_to_use, timeout=15)
|
||||
proxies=proxy_to_use, timeout=PROXY_TIMEOUT_S)
|
||||
print(response.status_code)
|
||||
if response.status_code == 200:
|
||||
print(response.text)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
PROXY_TIMEOUT_S = 20
|
||||
+2
-1
@@ -13,6 +13,7 @@ from models.result_pojo import RequestResult
|
||||
from queue_message.CookiesPublisher import CookiesPublisher
|
||||
from utils.address_ip import get_address_ip
|
||||
from workers.captcha_result_getter import CaptchaResultGetter
|
||||
from workers.proxy_constants import PROXY_TIMEOUT_S
|
||||
|
||||
|
||||
def get_chrome_version_from_ua(ua):
|
||||
@@ -206,7 +207,7 @@ class Sender:
|
||||
proxy_to_use = self.proxy_to_use
|
||||
# print(proxy_to_use)
|
||||
response = requests.post(url=url, proxies=proxy_to_use, verify=False, headers=headers, data=data,
|
||||
timeout=15, allow_redirects=False, impersonate="chrome99_android")
|
||||
timeout=PROXY_TIMEOUT_S, allow_redirects=False, impersonate="chrome99_android")
|
||||
self.logger.info(response.status_code)
|
||||
if response.status_code == 302:
|
||||
# add to mongodb
|
||||
|
||||
Reference in New Issue
Block a user