def some_function global list fo count_thread while len list urlz list

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
def some_function():
global list, fo, count_thread
while(len(list)>0):
urlz = list.pop()
data = StringIO.StringIO()
curl = pycurl.Curl()
curl.setopt(pycurl.FOLLOWLOCATION, 0)
curl.setopt(pycurl.CONNECTTIMEOUT, 20)
curl.setopt(pycurl.URL, urlz)
curl.setopt(pycurl.WRITEFUNCTION, data.write)
try:
curl.perform()
except:
pass
curl.close()
rez = data.getvalue()
#d = [random.choice(string.letters) for x in xrange(10)]
#s = "".join(d)
hash = md5.new(urlz).hexdigest()
fo = open('./bufdir/' + hash + '.txt','w')
#print rez
fo.write(str(urlz) + '\n' + rez)
fo.close
count_thread -= 1