import time from backup_monitoring.parsing.parsers import bpdbjobs as parser file = open('test.txt', 'r') stream = parser.stream(file) i = 0 for record in stream: i += 1 job = parser.parse(record) jobid = job.jobid jobtype = job.jobtype state = job.state stunit = job.stunit #print 'jobid=%d, jobtype=%s, state=%s, stunit=%s' % (jobid, jobtype, state, stunit) if jobtype == 'backup' and state == 'active': #print 'jobid=%d, jobtype=%s, state=%s, stunit=%s' % (jobid, jobtype, state, stunit) for key, value in job.items(): print '[%s] = [%s]' % (key, value) time.sleep(5) file.close()