[docs]defcollect(self):"""Collects all audit logs from the Torq API. This will first check whether there are any pointers cached to indicate previous collections. If not, a 7 day look-back of data will be collected. """client=Client(identity=self.identity,key=self.key)cursor=None# If no pointer is stored then a previous run hasn't been performed, so set the# pointer to 7-days ago.try:_=self.pointerexceptNotFoundException:self.pointer=(datetime.now(timezone.utc)-timedelta(days=7)).isoformat()whileTrue:log=client.get_audit_logs(start_time=self.pointer,cursor=cursor)# Save this batch of log entries.self.save(log.entries)# Check if we need to continue paging.cursor=log.cursorifcursorisNone:break