support data impulse
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import random
|
||||
|
||||
FR_ASOCKS_MOBILE_PROXY = {
|
||||
'http': 'http://11797317-mobile-country-FR:nv958134x@190.2.151.110:14046',
|
||||
'https': 'http://11797317-mobile-country-FR:nv958134x@190.2.151.110:14046',
|
||||
@@ -17,13 +19,42 @@ FR_PROXY_ASOCK_RES_2 = {
|
||||
'http': '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_MOB_OXY_STICKY = {
|
||||
'http': 'http://customer-rendezvousmob-cc-FR:Rdv202220212023@fr-pr.oxylabs.io:{}',
|
||||
'https': 'http://customer-rendezvousmob-cc-FR:Rdv202220212023@fr-pr.oxylabs.io:{}'
|
||||
}
|
||||
|
||||
FR_PROXY_DATA_IMPULSE_STICKY = {
|
||||
'http': 'http://1d568220dbefeff21ad4__cr.fr:df99489a25fa72d9@gw.dataimpulse.com:{}',
|
||||
'https': 'http://1d568220dbefeff21ad4__cr.fr:df99489a25fa72d9@gw.dataimpulse.com:{}'
|
||||
}
|
||||
|
||||
MOBILE_PROXY_LIST = [FR_PROXY_MOB_OXY_STICKY, FR_PROXY_DATA_IMPULSE_STICKY]
|
||||
|
||||
|
||||
class ProxyManager:
|
||||
|
||||
def __init__(self, logger):
|
||||
self.logger = logger
|
||||
|
||||
def get_link_validate_proxy(self, links_to_validate: list) -> list:
|
||||
if len(links_to_validate) > 15:
|
||||
return [FR_PROXY_RES_OXY, FR_PROXY_ASOCK_RES_2, FR_ASOCKS_MOBILE_PROXY]
|
||||
return [FR_PROXY_RES_OXY, FR_PROXY_ASOCK_RES_2]
|
||||
# return [FR_PROXY_RES_OXY]
|
||||
else:
|
||||
return [FR_PROXY_RES_OXY, FR_PROXY_ASOCK_RES_2, FR_ASOCKS_MOBILE_PROXY]
|
||||
return [FR_PROXY_RES_OXY, FR_PROXY_ASOCK_RES_2]
|
||||
# return [FR_PROXY_RES_OXY]
|
||||
|
||||
def get_proxy_for_appointment_request(self) -> dict:
|
||||
_chosen_proxy = random.choice(MOBILE_PROXY_LIST)
|
||||
if "oxylabs" in _chosen_proxy["http"]:
|
||||
self.logger.info("use oxylabs proxy")
|
||||
_port = random.randint(40001, 49999)
|
||||
else:
|
||||
self.logger.info("use dataimpulse proxy")
|
||||
_port = random.randint(10000, 20000)
|
||||
self.logger.info("generated port is {}".format(_port))
|
||||
_proxy_to_use = {}
|
||||
_proxy_to_use["http"] = _chosen_proxy["http"].format(_port)
|
||||
_proxy_to_use["https"] = _chosen_proxy["https"].format(_port)
|
||||
return _proxy_to_use
|
||||
|
||||
Reference in New Issue
Block a user