proxies = get_proxies()
for proxy in proxies:
try:
response = requests.get('https://httpbin.org/ip', proxies={'http': proxy, 'https': proxy})
print(response.json())
except Exception as e:
print(fError with {proxy}: {e})
2、虚拟拨号软件
原理:模拟物理拨号断线重连,每次获取新IP。
工具:Xshell(SSH隧道)、VPNC(企业级VPN客户端)。
操作步骤:
1、配置拨号连接(如ADSL拨号)。
2、使用脚本自动断开并重新连接:
bash
Linux/macOS
nmcli con down 连接名称 && sleep 5 && nmcli con up 连接名称
powershell
Windows
netsh interface set interface name=连接名称 admin=disabled
Start-Sleep -s 5
netsh interface set interface name=连接名称 admin=enabled