(self, query_filter)
return events
Collecting events one by one and skip those with parsing error.

        The parsing error is triggered by unknown types like `ContentLibrary`.
        More info:
            - https://github.com/vmware/pyvmomi/issues/190
            - https://github.com/vmware/pyvmomi/issues/872

        The event collection fallback is a workaround and can be removed when the upstream issues
        mentioned above are solved.
Collecting events one by one and skip those with parsing error.
Collecting events one by one and skip those with parsing error .
def _get_new_events_one_by_one(self, query_filter):
        # type: (vim.event.EventFilterSpec) -> List[vim.event.Event]
        """
        Collecting events one by one and skip those with parsing error.

        The parsing error is triggered by unknown types like `ContentLibrary`.
        More info:
            - https://github.com/vmware/pyvmomi/issues/190
            - https://github.com/vmware/pyvmomi/issues/872

        The event collection fallback is a workaround and can be removed when the upstream issues
        mentioned above are solved.
        """
        event_manager = self._conn.content.eventManager
        events = []
        event_collector = event_manager.CreateCollectorForEvents(query_filter)
        while True:
            try:
                collected_events = event_collector.ReadNextEvents(1)  # Read with page_size=1
            except SoapAdapter.ParserError as e:
                self.log.debug("Cannot parse event, skipped: %s", e)
                continue
            if len(collected_events) == 0:
                break
            event = collected_events[0]
            self.log.debug(
                "Collect event with id:%s, type:%s: msg:%s", event.key, type(event), event.fullFormattedMessage
            )
            events.extend(collected_events)
        return events
def _get_new_events_one_by_one ( self , query_filter ) : # type: (vim.event.EventFilterSpec) -> List[vim.event.Event] event_manager = self . _conn . content . eventManager events = [ ] event_collector = event_manager . CreateCollectorForEvents ( query_filter ) while True : try : collected_events = event_collector . ReadNextEvents ( 1 ) # Read with page_size=1 except SoapAdapter . ParserError as e : self . log . debug ( "Cannot parse event, skipped: %s" , e ) continue if len ( collected_events ) == 0 : break event = collected_events [ 0 ] self . log . debug ( "Collect event with id:%s, type:%s: msg:%s" , event . key , type ( event ) , event . fullFormattedMessage ) events . extend ( collected_events ) return events