def check(proxy):
import urllib2
url = "http://connect.rom.miui.com/generate_204"
proxy_handler = urllib2.ProxyHandler({'http': "http://" + proxy})
opener = urllib2.build_opener(proxy_handler, urllib2.HTTPHandler)
try:
response = opener.open(url, timeout=1)
return response.code == 204 and response.url == url
except Exception:
return False
评论列表
文章目录