Here is a small test driver program for the PageGet class. It reads from standard
input a file in access_log
format and displays each record's output on standard output.
#!/usr/bin/env python
#--
# pagegettest: Test driver for pageget.py
# For documentation, see www.nmt.edu/tcc/projects/webstats/ims/
#--
# Reads from standard input, expects a file that looks like access_log.
#--
import string, sys, datetime
from pageget import *
SYM_DOMAIN = ["nmt", "edu"]
IP_DOMAIN = ["129", "138"]
# - - - - - m a i n - - - - -
for pageGet in scanAccessLog ( sys.stdin ):
if pageGet.isFar ( SYM_DOMAIN, IP_DOMAIN ): local = "R"
else: local = "L"
print ( "%s %d %s %s\n %s" %
(local, pageGet.status,
pageGet.when.strftime ( "%Y-%m-%d %H:%M:%S %z" ),
pageGet.accessor, pageGet.url) )