|  | 
 
| 
import urllib.request
x
马上注册,结交更多好友,享用更多功能^_^您需要 登录 才可以下载或查看,没有账号?立即注册  import random
 
 url='http://myip.kkcha.com/'
 iplist=['123.163.116.157:9999']
 choiceip=random.choice(iplist)
 print(choiceip)
 proxy_support=urllib.request.ProxyHandler({'http':choiceip})
 
 opener=urllib.request.build_opener(proxy_support)
 opener.addheaders=[('User-Agent','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36')]
 urllib.request.install_opener(opener)
 
 #reg=urllib.request.Request(url)
 #print(type(opener))
 response=urllib.request.urlopen(url)
 html=response.read().decode('utf-8')
 
 print(html)
 
 
 我如果不用代理访问,就立刻马上能返回html 代码,但是加上代理了,60秒之后一直提示timeout ,这是为啥啊,代码应该没也错啊,求大神指点
 
复制代码proxies = {
  "http": "49.70.122.136:4216"
}
这个代理可用,实测
https://proxy.seofangfa.com/
从这个网站找的 | 
 |