import requests
def check_proxy(proxy):
try:
response = requests.get('http://example.com', proxies={'http': proxy, 'https': proxy}, timeout=10)
if response.status_code == 200:
print(f"Proxy {proxy} is working!")
else:
print(f"Proxy {proxy} is not working. Status code: {response.status_code}")
except Exception as e:
print(f"Proxy {proxy} is not working. Exception: {e}")
# Replace 'http://example.com' with the URL you want to use for testing
# Replace 'proxy_ip:port' with the actual proxy IP and port
proxy_to_check = 'proxy_ip:port'
check_proxy(proxy_to_check)
Değiştirdiğinizden emin olun 'proxy_ip:port'
kontrol etmek istediğiniz gerçek proxy IP'si ve bağlantı noktasıyla. Bu komut dosyası şuraya bir istek gönderir: http://example.com
sağlanan proxy'yi kullanarak yanıt durum kodunun 200 olup olmadığını kontrol eder. Durum kodu 200 ise proxy'nin çalıştığını yazdırır; aksi takdirde bir hata mesajı yazdırır. URL'yi ve zaman aşımı değerini gerektiği gibi ayarlayın.
Yorumlar (0)
Burada henüz yorum yok, ilk siz olabilirsiniz!