| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import requests
- # 目标 URL
- url = "https://ireland.blsspainglobal.com/Global/account/login"
- # 请求头
- headers = {
- 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
- 'accept-language': 'zh-CN,zh;q=0.9',
- 'upgrade-insecure-requests': '1',
- 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36',
- 'Cookie': '.AspNetCore.Antiforgery.oY6EC-RUIyA=CfDJ8P1AkyeYcD1Ite9P68eByJroaIfpxao3RR7eDNqGHFCzilNlvksu3Lm1hSGPhPfSnGJdMIWBtHWKKamv82f-fWknhJkdW1gH5X_OEuMWGrlDGJiwOcCOmdSzaTH14Yh6lveEAlEaUhblp38cJ_gaUFc'
- }
- # 待测试的代理列表
- proxy_list = [
- "9zMOkhCng5HG8SZ:RTBuPWx1CEr6DfD@95.135.130.73:48306",
- "aNCaMFjblyODleO:5i4lV3VjNwE4bkL@95.135.130.76:41553"
- ]
- print(f"{'Proxy IP':<30} | {'Status':<10} | {'Result'}")
- print("-" * 60)
- for proxy_str in proxy_list:
- # 构造 requests 库需要的 proxy 字典格式
- # 格式为: http://user:password@ip:port
- proxies = {
- "http": f"http://{proxy_str}",
- "https": f"http://{proxy_str}"
- }
- try:
- # 发送请求,设置超时时间为 10 秒,防止死等
- response = requests.get(url, headers=headers, proxies=proxies, timeout=10)
-
- status_code = response.status_code
-
- if status_code == 200:
- result = "✅ 正常 (Normal)"
- elif status_code == 403:
- result = "🚫 封禁 (Blocked 403)"
- else:
- result = f"⚠️ 其他 ({status_code})"
-
- print(f"{proxy_str.split('@')[1]:<30} | {status_code:<10} | {result}")
- except requests.exceptions.ProxyError:
- print(f"{proxy_str.split('@')[1]:<30} | Error | ❌ 代理连接失败")
- except requests.exceptions.ConnectTimeout:
- print(f"{proxy_str.split('@')[1]:<30} | Timeout | ❌ 连接超时")
- except Exception as e:
- print(f"{proxy_str.split('@')[1]:<30} | Error | ❌ 发生错误: {str(e)[:20]}")
|