def gather_product_list()

in legacy/adobe_tools/adobe_api.py [0:0]


    def gather_product_list(self, force=False):
        """
        Get the list of product configurations by asking the API.

        Returns 'productlist', which is a list of dictionaries containing all
        the Configuration groups in use.
        If 'force' is true, the API call will be made regardless of cache.
        If a non-200 status code is returned by the API, an exception is
        raised.

        Example:
        ```
        >>>> api.productlist[0]
        {u'memberCount': 182, u'groupName': u'Administrators'}
        >>> api.productlist[1]
        {u'memberCount': 912,
        u'groupName':
            u'Default Document Cloud for enterprise - Pro Configuration'}
        ```
        """
        if force or not self.productlist:
            page = 0
            result = {}
            productlist = []
            while result.get('lastPage', False) is not True:
                url = "https://" + self.configs['host'] + \
                    self.configs['endpoint'] + "/groups/" + \
                    self.configs['org_id'] + "/" + str(page)
                try:
                    result = self.__submit_request(url)
                    productlist += result.get('groups', [])
                    page += 1
                except AdobeAPIBadStatusException:
                    raise
            self.productlist = productlist
        # Update the cache
        if self.cache:
            self.__write_cache()
        return self.productlist