<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import requests
import ssl
from requests.packages.urllib3.poolmanager import PoolManager
from requests.packages.urllib3.util import ssl_
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
import logging
from requests_ip_rotator import ApiGateway, EXTRA_REGIONS, ALL_REGIONS
import random
import json
from curl_cffi import requests as cffireq


CIPHERS = "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384: ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:AES256-SHA"

NEW_ALL_REGIONS = ALL_REGIONS + ["ap-south-2", "ap-southeast-3", "ap-southeast-4", "ca-west-1", "eu-central-2", "eu-south-2", "il-central-1", "me-central-1"]


class TlsAdapter(HTTPAdapter):
    def __init__(self, ssl_options=0, **kwargs):
        self.ssl_options = ssl_options
        super(TlsAdapter, self).__init__(
            **kwargs, pool_maxsize=5, max_retries=3, pool_block=False
        )

    def init_poolmanager(self, *pool_args, **pool_kwargs):
        ctx = ssl_.create_urllib3_context(
            ciphers=CIPHERS, cert_reqs=ssl.CERT_REQUIRED, options=self.ssl_options
        )
        self.poolmanager = PoolManager(*pool_args, ssl_context=ctx, **pool_kwargs)


class RequestManager(object):
    def __init__(self):
        self.adapter = TlsAdapter(ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1)
        self.iproyal_alternator = 1
        self.iproyal_pwlist = ["mArgare1he_region-europe", "mArgare1he_region-europe_streaming-1", "mArgare1he_region-northamerica", "mArgare1he_region-northamerica_streaming-1", "mArgare1he_streaming-1"]

    def createAWSGateways(self):
        all_sessions = []
        for region in NEW_ALL_REGIONS:
            gateway = ApiGateway("https://steamcommunity.com", access_key_id="AKIAVRYQ3XK3I75DLJEH", access_key_secret="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", regions=[str(region)])
            gateway.start()
            aws_session = requests.Session()
            aws_session.mount("https://steamcommunity.com", gateway)
            all_sessions.append(aws_session)
        self.aws_sessions = all_sessions

    def getRequest(self, url, get_alternator=0) -&gt; requests.Response:
        if get_alternator == 2:
            return self.getAWSRequest(url)
        if get_alternator == 1:
            return self.getIPRoyalRequest(url)
        if get_alternator == 0:
            return self.getProxyScrapeResidentialRequest(url)
        
    
    def getIPRoyalRequest(self, url):
        self.iproyal_alternator = (self.iproyal_alternator + 1) % 4
        iproyal_proxy = "http://alex133769:" + str(self.iproyal_pwlist[self.iproyal_alternator]) + "@geo.iproyal.com:12321"
        proxies = {"https": iproyal_proxy, "http": iproyal_proxy}
        try:
            print("Trying to get " + str(url) + " with IPRoyal // " + str(self.iproyal_alternator)) 
            response = cffireq.get(url, timeout=7, impersonate="chrome110", proxies=proxies)
            if response.status_code != 200:
                return None
            return response
        except Exception as e:
            print(str(e))
        return None
    
    # def getWebshareResidentialRequest(self, url):
    #     webshare_proxy = "http://epjpkomj-" + str(random.randint(1,215084)) + ":ghkncby8ddpl@p.webshare.io:80"
    #     proxies = {"https": webshare_proxy, "http": webshare_proxy}
    #     try:
    #         print("Trying to get " + str(url) + " with Webshare") 
    #         response = cffireq.get(url, timeout=7, impersonate="chrome110", proxies=proxies)
    #         if response.status_code != 200:
    #             return None
    #         return response
    #     except Exception as e:
    #         print(str(e))
    #     return None
    
    def getProxyScrapeResidentialRequest(self, url):
        proxyscrape_proxy = "http://che4pvco7u1h1db:bvt6yy7wrahb637@rp.proxyscrape.com:6060"
        proxies = {"https": proxyscrape_proxy, "http": proxyscrape_proxy}
        try:
            print("Trying to get " + str(url) + " with Proxyscrape") 
            response = cffireq.get(url, timeout=7, impersonate="chrome110", proxies=proxies)
            if response.status_code != 200:
                return None
            return response
        except Exception as e:
            print(str(e))
        return None

    def getAWSRequest(self, url) -&gt; requests.Response:
        try:
            print("Trying to get " + str(url) + " with AWS")
            aws_session = random.choice(self.aws_sessions)
            aws_response = aws_session.get(url, timeout=15)
        except Exception as e:
            print(str(e))
            return None
        return aws_response
    
    def getRequestNaked(self, url) -&gt; requests.Response:
        print("Trying to get " + str(url) + " naked")
        s = requests.Session()
        r = s.get(url)
        return r
    
    def postRequestNaked(self, url, json) -&gt; requests.Response:
        print("Trying to post " + str(url) + " naked")
        s = requests.Session()
        r = s.post(url, json=json)
        return r</pre></body></html>