[twill] twill with threads

C. Titus Brown ctb at msu.edu
Wed Dec 17 21:03:38 PST 2008


On Tue, Dec 16, 2008 at 05:36:28PM -0200, Macarse wrote:
-> 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

Hi,

->         #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()

You could do this with twill easily enough -- just do

   browser = twill.commands.browser
   statusPage = browser.get_html()

-> my question is: Is ok to use twill like that?
-> Is it thread safe?

...however, unfortunately, the commands interface in twill is not thread
safe, and mechanize (which twill uses to actually do anything :) may
also not be threadsafe.

best,
--titus
-- 
C. Titus Brown, ctb at msu.edu



More information about the twill mailing list