Python Forum
Backconnect proxy, response timeout
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Backconnect proxy, response timeout
#2
Problem solved!!

def main_request(data, proxy='', type_of_proxy='socks5', user_agent='Mozilla/5.0 (Linux; arm; Android 13; PEPM00) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.141 YaBrowser/22.3.6.61.00 SA/3 Mobile Safari/537.36'):
 
class TimeoutHTTPAdapter(HTTPAdapter):
    def __init__(self, *args, **kwargs):
        if "timeout" in kwargs:
            self.timeout = kwargs["timeout"]
            del kwargs["timeout"]
        super().__init__(*args, **kwargs)
 
    def send(self, request, **kwargs):
        timeout = kwargs.get("timeout")
        if timeout is None and hasattr(self, 'timeout'):
            kwargs["timeout"] = self.timeout
        return super().send(request, **kwargs)
  
s = requests.Session()
  
 s.mount('http://', TimeoutHTTPAdapter(timeout=5))  # 5 seconds
s.mount('https://', TimeoutHTTPAdapter(timeout=5))
  
  
proxies = {
                'http': f'{type_of_proxy}://{proxy}',
                'https': f'{type_of_proxy}://{proxy}'
            }
  
page_login = s.post('https://my-site.com', data=data_1.encode('utf-8'), verify=False,
                                proxies=proxies, headers=headers_dic,timeout=timeout_request)
  
print(main_request(data='1',proxy='login:[email protected]:16000',type_of_proxy='http'))
Reply


Messages In This Thread
Backconnect proxy, response timeout - by 3frenky3 - Jul-14-2023, 04:11 PM
RE: Backconnect proxy, response timeout - by 3frenky3 - Jul-14-2023, 04:19 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  telnetlib timeout kerzol81 0 3,442 Sep-12-2019, 08:38 AM
Last Post: kerzol81

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020