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)

这里还没有评论,你可以成为第一个评论者!

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注


选择和购买代理

数据中心代理

轮流代理

UDP代理机构

受到全球 10000 多家客户的信赖

代理客户
代理客户
代理客户 flowch.ai
代理客户
代理客户
代理客户