def proxy_identify(proxy, url):
cookie = cookielib.LWPCookieJar()
handler = urllib2.HTTPCookieProcessor(cookie)
proxy_support = urllib2.ProxyHandler({'http': proxy})
opener = urllib2.build_opener(proxy_support, handler)
try:
response = opener.open(url, timeout=3)
if response.code == 200:
c = ''
for item in cookie:
c += item.name+'='+item.value+';'
print c
IpProxy.sogou_cookie.append(c)
return True
except Exception, error:
print error
return False
评论列表
文章目录