473,405 Members | 2,415 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

expect-like package

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.

Dec 20 '05 #1
2 1050
On 21/12/05, Eric McCoy <ct******@comcast.net> 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
Dec 21 '05 #2
In article <ma***************************************@python. org>,
Stephen Thorne <st************@gmail.com> wrote:
On 21/12/05, Eric McCoy <ct******@comcast.net> 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/

Dec 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: z0mb1e_fr | last post by:
I am writing a script to change a router config. The config is long and the result is that the display stops with a "--more--". Normally we type return to go to a new line or the space bar to go...
0
by: Kevin Cheramie | last post by:
I'm unsure how to break down and use what is returned by expect in the rest of my script. I want to issue a command and split the results of that command into several different variables. I then...
2
by: Mak | last post by:
Hi Everybody, I try set the Expect: 100-continue in my request to server. The way I do it is by setting : <META http-equiv="Expect" content="100-continue"> in my html page. But, it does not...
1
by: Sektor van Skijlen | last post by:
couldn't compile regular expression pattern: quantifier operand invalid while executing "expect -nobrace >|#S {} -re {* } { lappend response_line $expect_out(buffer); exp_continue }" invoked from...
1
by: graphman | last post by:
I have a perl script that I'm calling using php's shell_exec that uses an expect module to go to another system to pull tiff files. The php perl combination works great when I launch from the...
1
by: iask | last post by:
Hi, I am a rookie to learn Tcl/Expect,I want to know how to store a expect output in a variable? when I using the command "send ",then maybe many output,I don't want just expect one all some...
2
by: kwr2k | last post by:
Hi, I am trying to install Expect.pm on HP-UX. I get the following error: ------------------------------------------------------------------- $ perl Makefile.PL...
1
by: tushara | last post by:
Hi, When I am trying to spawn using Expect I am getting repetition of previous window which I have created before calling Expect. So now I am getting repetition of the same page in same window....
0
by: seanovision | last post by:
Hi, I've been wrestling with this for a few days and I'm not sure what I'm doing wrong. I'm writing a script that will eventually sign several certificate signing requests (CSRs) using openssl....
3
by: bollweevil | last post by:
Hello Everyone, I do Django web development on my Mac at home, and then I rsync the files with the Ubuntu web server. I want to write one single bash shell script that rsyncs the files and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.