Try /Except inside for loop not behaving as expected
Try /Except inside for loop not behaving as expected Question: CODE : def ValidateProxy(LIST_PROXIES): ”’ Checks if scraped proxies allow HTTPS connection ”’ for proxy in LIST_PROXIES: print(‘using’, proxy) host, port = str(proxy).split(“:”) try: resp = requests.get(‘https://amazon.com’, proxies=dict(https=f’socks5://{host}:{port}’), timeout=6) except ConnectionError: print(proxy, ‘REMOVED’) LIST_PROXIES.remove(proxy) print(len(LIST_PROXIES), ‘PROXIES GATHERED’) if len(LIST_PROXIES) != 0: return LIST_PROXIES else: return …