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)
꼭 교체하세요 'proxy_ip:port'
확인하려는 실제 프록시 IP 및 포트를 사용하세요. 이 스크립트는 다음으로 요청을 보냅니다. http://example.com
제공된 프록시를 사용하여 응답 상태 코드가 200인지 확인합니다. 상태 코드가 200이면 프록시가 작동 중임을 인쇄합니다. 그렇지 않으면 오류 메시지가 인쇄됩니다. 필요에 따라 URL 및 시간 초과 값을 조정합니다.
댓글 (0)
여기에는 아직 댓글이 없습니다. 첫 번째 댓글이 되실 수 있습니다!