Python timer

Martin von Loewis loewis at informatik.hu-berlin.de
Fri Oct 22 16:34:00 EDT 1999


rainer2207 at my-deja.com writes:

> I would like to write a CGI script which automatically refreshes the
> HTML page it displays. I was wondering if there is a timer function and
> how it can be used.

The most simple thing to do is time.sleep; see the documentation of
the time module for details.

To implement the automatic refreshing, you could use either server
push (i.e. multipart/x-mixed-replace MIME type), or client-pull
(i.e. Refresh: HTTP response header). In the latter case, you don't
need a timer loop - the client will reload the document on its own.
See http://www.sfi.com.tw/~wong/tstpages/dynatst.htm for a brief
introduction.

Hope this helps,
Martin




More information about the Python-list mailing list