import random
import requests
import socket
url="https://cn.bing.com/"
def readme(str,i):
f=open(str,'r+')
lines=f.readlines()
return lines[i]
#验证代理是否可用
def ip_pool():
socket.setdefaulttimeout(2)
ip_pool_list=[]
for i in range(0,15):
s=readme('K:/zhusc/test.txt',i).replace('\n','')
proxies={'http':s}
try:
res=requests.get(url,proxies=proxies)
ip_pool_list.append(s)
except Exception as ex:
continue
return(ip_pool_list)
print(ip_pool())
验证IP代理是否可用
最新推荐文章于 2024-05-09 14:23:42 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)