Hi, I am doing a script that:
- Gets a list of ips
- Sets a threadpool
- With twill it logins to the http
- with urlib2 gets some html
The code that it's run in the threads looks like this:
def checkIP(ip):
global results, resultsLock
ret = False
req = urllib2.Request( ip )
try:
response = urllib2.urlopen(req)
homePage = response.read()
#login
go(ip + '/login.asp')
fv('1', 'user', 'user')
fv('1', 'password', 'password')
submit('3')
req = urllib2.Request(ip + '/status.asp')
response = urllib2.urlopen(req)
statusPage = response.read()
resultsLock.acquire()
results.write(ip)
resultsLock.release()
except URLError, e:
ret = False
except BadStatusLine, e:
ret = False
return ret
my question is: Is ok to use twill like that?
Is it thread safe?
Thanks for reading!
_______________________________________________
twill mailing list
[email protected]
http://lists.idyll.org/listinfo/twill