(self, api_method, collection_name, **kwargs)
return objs
Return all objects in an api_method, handle pagination, and pass
        kwargs on to the method being called.

        For example, "users.list" returns an object like:

        {
            "members": [{<member_obj>}, {<member_obj_2>}],
            "response_metadata": {
                "next_cursor": "cursor_id"
            }
        }

        so if you call `get_all("users.list", "members")`, this function
        will return all member objects to you while handling pagination
Return all objects in an api_method, handle pagination, and pass
        kwargs on to the method being called.
Return all objects in an api_method handle pagination and pass kwargs on to the method being called .
def get_all(self, api_method, collection_name, **kwargs):
        """
        Return all objects in an api_method, handle pagination, and pass
        kwargs on to the method being called.

        For example, "users.list" returns an object like:

        {
            "members": [{<member_obj>}, {<member_obj_2>}],
            "response_metadata": {
                "next_cursor": "cursor_id"
            }
        }

        so if you call `get_all("users.list", "members")`, this function
        will return all member objects to you while handling pagination
        """
        objs = []
        limit = 250
        # if you don't provide a limit, the slack API won't return a cursor to you
        page = json.loads(self.api_call(api_method, limit=limit, **kwargs))
        while 1:
            try:
                for obj in page[collection_name]:
                    objs.append(obj)
            except KeyError:
                LOG.error(
                    "Unable to find key %s in page object: \n" "%s",
                    collection_name,
                    page,
                )

                return objs

            cursor = dig(page, "response_metadata", "next_cursor")
            if cursor:
                # In general we allow applications that integrate with Slack to send
                # no more than one message per second
                # https://api.slack.com/docs/rate-limits
                time.sleep(1)
                page = json.loads(
                    self.api_call(api_method, cursor=cursor, limit=limit, **kwargs)
                )
            else:
                break

        return objs
def get_all ( self , api_method , collection_name , * * kwargs ) : objs = [ ] limit = 250 # if you don't provide a limit, the slack API won't return a cursor to you page = json . loads ( self . api_call ( api_method , limit = limit , * * kwargs ) ) while 1 : try : for obj in page [ collection_name ] : objs . append ( obj ) except KeyError : LOG . error ( "Unable to find key %s in page object: \n" "%s" , collection_name , page , ) return objs cursor = dig ( page , "response_metadata" , "next_cursor" ) if cursor : # In general we allow applications that integrate with Slack to send # no more than one message per second # https://api.slack.com/docs/rate-limits time . sleep ( 1 ) page = json . loads ( self . api_call ( api_method , cursor = cursor , limit = limit , * * kwargs ) ) else : break return objs