use iproyal proxies
This commit is contained in:
@@ -3,6 +3,8 @@ import random
|
||||
|
||||
import requests
|
||||
|
||||
from utils.iproayl_stick_proxy_list import FR_IPROYAL_STICKY_PROXY_LIST
|
||||
|
||||
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',
|
||||
@@ -58,12 +60,6 @@ FR_RES_IP_ROYAL_ROTATING = {
|
||||
'http': 'http://Uv2qfG3PyhT6Wctw:V45HOlzAIssCYssJ_country-fr@geo.iproyal.com:12321',
|
||||
'https': 'http://Uv2qfG3PyhT6Wctw:V45HOlzAIssCYssJ_country-fr@geo.iproyal.com:12321',
|
||||
}
|
||||
# 八分之一用data_impulse
|
||||
# MOBILE_PROXY_LIST = [FR_PROXY_MOB_OXY_STICKY, FR_PROXY_MOB_OXY_STICKY, FR_PROXY_MOB_OXY_STICKY, FR_PROXY_MOB_OXY_STICKY,
|
||||
# FR_PROXY_MOB_OXY_STICKY, FR_MOBILE_ANY_IP_STICKY, FR_MOBILE_ANY_IP_STICKY, FR_MOBILE_ANY_IP_STICKY,
|
||||
# FR_MOBILE_ANY_IP_STICKY, FR_MOBILE_ANY_IP_STICKY,
|
||||
# FR_PROXY_RES_OXY_STICKY,
|
||||
# FR_PROXY_DATA_IMPULSE_STICKY]
|
||||
|
||||
|
||||
# MOBILE_PROXY_LIST = [FR_MOBILE_ANY_IP_STICKY, FR_PROXY_MOB_OXY_STICKY]
|
||||
@@ -89,31 +85,43 @@ class ProxyManager:
|
||||
# return [FR_PROXY_RES_OXY, FR_PROXY_MOB_OXY, FR_PROXY_ASOCK_RES_2, FR_DATA_IMPULSE_RES]
|
||||
# return [FR_PROXY_RES_OXY]
|
||||
|
||||
def get_random_sticky_iproyal_proxy(self) -> dict:
|
||||
_session_info = random.choice(FR_IPROYAL_STICKY_PROXY_LIST)
|
||||
_proxy_template = {
|
||||
'http': 'http://{}@geo.iproyal.com:12321',
|
||||
'https': 'http://{}@geo.iproyal.com:12321',
|
||||
}
|
||||
_proxy_to_use = {}
|
||||
_proxy_to_use["http"] = _proxy_template["http"].format(_session_info)
|
||||
_proxy_to_use["https"] = _proxy_template["https"].format(_session_info)
|
||||
return _proxy_to_use
|
||||
|
||||
def get_result_link_proxy(self):
|
||||
return [FR_PROXY_RES_OXY, FR_PROXY_ASOCK_RES_2, FR_DATA_IMPULSE_RES, FR_ASOCKS_MOBILE_PROXY]
|
||||
|
||||
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(900000000, 995869818)
|
||||
elif "anyip" in _chosen_proxy["http"]:
|
||||
self.logger.info("use anyip 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
|
||||
return self.get_random_sticky_iproyal_proxy()
|
||||
# _chosen_proxy = random.choice(MOBILE_PROXY_LIST)
|
||||
# if "oxylabs" in _chosen_proxy["http"]:
|
||||
# self.logger.info("use oxylabs proxy")
|
||||
# _port = random.randint(900000000, 995869818)
|
||||
# elif "anyip" in _chosen_proxy["http"]:
|
||||
# self.logger.info("use anyip 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
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
_logger = logging.getLogger()
|
||||
_proxy = ProxyManager(logger=_logger)
|
||||
_proxise = _proxy.get_proxy_for_appointment_request()
|
||||
_proxise = _proxy.get_random_sticky_iproyal_proxy()
|
||||
print(_proxise)
|
||||
response = requests.get(
|
||||
"https://ip.oxylabs.io/location",
|
||||
|
||||
Reference in New Issue
Block a user