Connection tester

Nigel Rantor wiggly at wiggly.org
Wed Jun 10 11:29:36 EDT 2009


Sparky wrote:
> Hey! I am developing a small application that tests multiple websites
> and compares their "response time". Some of these sites do not respond
> to a ping and, for the measurement to be standardized, all sites must
> have the same action preformed upon them. Another problem is that not
> all of the sites have the same page size and I am not interested in
> how long it takes to load a page but instead just how long it takes
> for the website to respond. Finally, I am looking to keep this script
> platform independent, if at all possible.

Yes, lots of people block ICMP so you can't use it to reliably tell
whether a machine is there or not.

At least three possible solutions.

1) Perform a HEAD request against the document root. This is likely to
be a static page and making it a HEAD request will make most responses
take similar times.

2) Perform an OPTIONS request as specified in the RFC below for the *
resource. This doesn't always work.

3) Perform a request you believe will fail so that you are provided with
a 4XX error code, the only time this should take any appreciable time is
when someone has cute server-generated error pages.

HTTP/1.1 RFC - http://www.ietf.org/rfc/rfc2616.txt

  n



More information about the Python-list mailing list