hello my whole code has troubles because of this : i want to make a loop as, if a post request doesn't work it does another with the next proxy which is the file list, etc (do this until i get no errors). But i struggle converting this try and except example into a loop
try:
requests.post(url, headers={"Accept": "application/json"}, proxies =proxy1).json()
except requests.exceptions.ConnectionError or requests.exceptions.ConnectTimeout or requests.exceptions.ProxyError or urllib3.exceptions.MaxRetryError or urllib3.exceptions.NewConnectionError or OSError:
#takeAnotherProxy and do another post request
with open ("proxielist.txt",'r') as test:
linee = test.readlines()
proxy = linee[g].rstrip()
proxy1 = {
"http": 'http://' + proxy,
"https": 'http://' + proxy}
try:
requests.post(url, headers={"Accept": "application/json"}, proxies =proxy1).json()
except requests.exceptions.ConnectionError or requests.exceptions.ConnectTimeout or requests.exceptions.ProxyError or urllib3.exceptions.MaxRetryError or urllib3.exceptions.NewConnectionError or OSError