<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7036.0">
<TITLE>RE: [twill] twill with threads</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>We've been using Twill recently to do volume testing of a web site. Each simulated user is a separate CPython process running Twill. The processes are lightweight enough that a single ordinary PC with 2GB of RAM can easily simulate dozens of users.<BR>
<BR>
Barry<BR>
<BR>
-----Original Message-----<BR>
From: twill-bounces@lists.idyll.org [<A HREF="mailto:twill-bounces@lists.idyll.org">mailto:twill-bounces@lists.idyll.org</A>] On Behalf Of C. Titus Brown<BR>
Sent: Thursday, December 18, 2008 12:04 AM<BR>
To: Macarse<BR>
Cc: twill@lists.idyll.org<BR>
Subject: Re: [twill] twill with threads<BR>
<BR>
On Tue, Dec 16, 2008 at 05:36:28PM -0200, Macarse wrote:<BR>
-&gt; Hi, I am doing a script that:<BR>
-&gt; - Gets a list of ips<BR>
-&gt; - Sets a threadpool<BR>
-&gt; - With twill it logins to the http<BR>
-&gt; - with urlib2 gets some html<BR>
<BR>
Hi,<BR>
<BR>
-&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #login<BR>
-&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; go(ip + '/login.asp')<BR>
-&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fv('1', 'user', 'user')<BR>
-&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fv('1', 'password', 'password')<BR>
-&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; submit('3')<BR>
-&gt;<BR>
-&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; req = urllib2.Request(ip + '/status.asp')<BR>
-&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; response = urllib2.urlopen(req)<BR>
-&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; statusPage = response.read()<BR>
<BR>
You could do this with twill easily enough -- just do<BR>
<BR>
&nbsp;&nbsp; browser = twill.commands.browser<BR>
&nbsp;&nbsp; statusPage = browser.get_html()<BR>
<BR>
-&gt; my question is: Is ok to use twill like that?<BR>
-&gt; Is it thread safe?<BR>
<BR>
...however, unfortunately, the commands interface in twill is not thread<BR>
safe, and mechanize (which twill uses to actually do anything :) may<BR>
also not be threadsafe.<BR>
<BR>
best,<BR>
--titus<BR>
--<BR>
C. Titus Brown, ctb@msu.edu<BR>
<BR>
_______________________________________________<BR>
twill mailing list<BR>
twill@lists.idyll.org<BR>
<A HREF="http://lists.idyll.org/listinfo/twill">http://lists.idyll.org/listinfo/twill</A><BR>
</FONT>
</P>

</BODY>
</HTML>