def getWant(line):#??????
keyword = keyword_list[line]
url = url_list[line]
try:
c = pycurl.Curl()
c.setopt(c.URL,url)
c.setopt(c.CONNECTTIMEOUT, 60)
c.setopt(c.TIMEOUT,120)
b = StringIO.StringIO()
c.setopt(c.WRITEFUNCTION,b.write)
c.perform()
html = b.getvalue()
mutex.acquire()
global match
global all
global percentage
if(getIfmatch(html)):
match += 1
else:
pass
all += 1
print 'all: '+str(all)+' match: '+str(match)+', percentage '+'%.1f'%((float(match)/all)*100)+'%'
mutex.release()
except:
print '%s Empty reply from server' %keyword
评论列表
文章目录