Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > expect-like package

Reply
Thread Tools

expect-like package

 
 
Eric McCoy
Guest
Posts: n/a
 
      12-20-2005
I'm looking for a way to create simple scripts which should be
accessible to a technical, though non-programmer, person. These scripts
are basically network service checks so I don't need much power: "send
this line," "if this line matches, keep going," and "if this line
matches, quit immediately." So for HTTP, for example, I'd use something
like this:

send "HEAD / HTTP/1.0"
send "Host: server.host.name"
send ""
expect ...
"^HTTP/1\.0 200.*" then return success
"^HTTP/1\.0 4\d\d.*" then return warning
else return error

It would also be nice if a more complex version could be written to
handle redirects by grepping out the new target and then attempting to
fetch that URI, but that's not a requirement.

I looked at expect and a pure-Python reimplementation of same, but they
both want to spawn external processes. Since I will be running more
than 10 checks a second that would be bad. I also need to be able to
implement a hard timeout, so if any check takes longer than, for
example, 5 seconds, it automatically fails. A log of the transaction
would also be good so that we can quickly find out why checks are
failing. And another reason not to do this in Python is that I want
checks to be configurable on the fly and stored in a database. I know
Python can do that but I want them sandboxed so that an error in a
user-built script won't take down the entire application.

I can roll my own but that would be a PITA so I'd prefer to use an
existing package if one exists. Anyone know of any? Thanks!

P.S. I will try to monitor the group but email replies would be appreciated.

 
Reply With Quote
 
 
 
 
Stephen Thorne
Guest
Posts: n/a
 
      12-21-2005
On 21/12/05, Eric McCoy <(E-Mail Removed)> wrote:
> So for HTTP, for example, I'd use something
> like this:
>
> send "HEAD / HTTP/1.0"
> send "Host: server.host.name"
> send ""
> expect ...
> "^HTTP/1\.0 200.*" then return success
> "^HTTP/1\.0 4\d\d.*" then return warning
> else return error


Have a look at these:
http://www.idyll.org/~t/www-tools/twill.html
http://pbp.berlios.de/
http://www.openqa.org/selenium/

--
Stephen Thorne
Development Engineer
 
Reply With Quote
 
 
 
 
Cameron Laird
Guest
Posts: n/a
 
      12-21-2005
In article <(E-Mail Removed)>,
Stephen Thorne <(E-Mail Removed)> wrote:
>On 21/12/05, Eric McCoy <(E-Mail Removed)> wrote:
>> So for HTTP, for example, I'd use something
>> like this:
>>
>> send "HEAD / HTTP/1.0"
>> send "Host: server.host.name"
>> send ""
>> expect ...
>> "^HTTP/1\.0 200.*" then return success
>> "^HTTP/1\.0 4\d\d.*" then return warning
>> else return error

>
>Have a look at these:
> http://www.idyll.org/~t/www-tools/twill.html
> http://pbp.berlios.de/
> http://www.openqa.org/selenium/

.
.
.
In a different direction, <URL: http://pexpect.sf.net >.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Package HTML - Missing package documentation file jochenhebbrecht@gmail.com Java 1 11-27-2007 01:59 PM
Package that imports with name of dependent package David Pratt Python 4 05-13-2006 05:12 PM
single package import v/s the entire package Parvinder Java 6 02-27-2005 02:02 PM
package module import name clash with global package George P Python 3 09-11-2004 01:19 PM
Importing a package and looping through modules in the package Dave Python 2 02-10-2004 08:14 PM



Advertisments