(self, *args, **options)
Try to process Events listed from the API.
Try to process Events listed from the API.
Try to process Events listed from the API .
def handle(self, *args, **options):
        """Try to process Events listed from the API."""
        # Set the verbosity to determine how much we output, if at all.
        self.set_verbosity(options)

        event_ids = options["ids"]
        failed = options["failed"]
        type_filter = options["type"]

        # Args are mutually exclusive,
        # so output what we are doing based on that assumption.
        if failed:
            self.output("Processing all failed events")
        elif type_filter:
            self.output(
                "Processing all events that match {filter}".format(filter=type_filter)
            )
        elif event_ids:
            self.output("Processing specific events {events}".format(events=event_ids))
        else:
            self.output("Processing all available events")

        # Either use the specific event IDs to retrieve data, or use the api_list
        # if no specific event IDs are specified.
        if event_ids:
            listed_events = (
                models.Event.stripe_class.retrieve(
                    id=event_id, api_key=djstripe_settings.STRIPE_SECRET_KEY
                )
                for event_id in event_ids
            )
        else:
            list_kwargs = {}
            if failed:
                list_kwargs["delivery_success"] = False

            if type_filter:
                list_kwargs["type"] = type_filter

            listed_events = models.Event.api_list(**list_kwargs)

        self.process_events(listed_events)
def handle ( self , * args , * * options ) : # Set the verbosity to determine how much we output, if at all. self . set_verbosity ( options ) event_ids = options [ "ids" ] failed = options [ "failed" ] type_filter = options [ "type" ] # Args are mutually exclusive, # so output what we are doing based on that assumption. if failed : self . output ( "Processing all failed events" ) elif type_filter : self . output ( "Processing all events that match {filter}" . format ( filter = type_filter ) ) elif event_ids : self . output ( "Processing specific events {events}" . format ( events = event_ids ) ) else : self . output ( "Processing all available events" ) # Either use the specific event IDs to retrieve data, or use the api_list # if no specific event IDs are specified. if event_ids : listed_events = ( models . Event . stripe_class . retrieve ( id = event_id , api_key = djstripe_settings . STRIPE_SECRET_KEY ) for event_id in event_ids ) else : list_kwargs = { } if failed : list_kwargs [ "delivery_success" ] = False if type_filter : list_kwargs [ "type" ] = type_filter listed_events = models . Event . api_list ( * * list_kwargs ) self . process_events ( listed_events )