Code: Alles auswählen
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'):
s = requests.Session()
retry = Retry(connect=3, backoff_factor=0.7)
adapter = HTTPAdapter(max_retries=retry)
s.mount('http://', adapter)
s.mount('https://', adapter)
if type_of_proxy == 'socks5':
timeout_request = 3
elif type_of_proxy == 'http':
timeout_request = 1
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:pass@backconnect.proxy.com:16000',type_of_proxy='http'))
Wie kann ich das Warten auf eine Antwort begrenzen? Ich habe schon alles versucht.
Bei sock5 funktioniert alles wie es soll.