def getRandomLogEntry(fileName): line = random.choice(open(fileName).readlines()) entry = LogEntry(line) now = datetime.now(timezone.utc) entry.timeStamp = now.astimezone() return entry
def generateLogEntry(): line = '188.127.233.220 - - [22/Jan/2016:09:35:54 +0100] "GET /almhuette-raith.at.tgz HTTP/1.1" 200 228' entry = LogEntry(line) now = datetime.now(timezone.utc) entry.timeStamp = now.astimezone() return entry