def gather_user_list()

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


    def gather_user_list(self, force=False):
        """
        Get a list of all users by querying the API.

        Returns 'userlist', which is a list of dictionaries containing all the
        users in our org.
        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.userlist[0]
        {u'status':
            u'active', u'username': u'email@fb.com', u'domain': u'fb.com',
        u'firstname': u'Fake Firstname', u'lastname': u'Fake Lastname',
        u'groups': [
            u'Default Document Cloud for enterprise - Pro Configuration',
            u'Default All Apps plan - 100 GB Configuration',
            u'Default Illustrator CC - 0 GB Configuration',
            u'Default InDesign CC - 0 GB Configuration',
            u'Default Photoshop CC - 0 GB Configuration'],
        u'country': u'US', u'type': u'federatedID', u'email': u'email@fb.com'}
        """
        if force or not self.userlist:
            page = 0
            result = {}
            userlist = []
            while result.get('lastPage', False) is not True:
                url = "https://" + self.configs['host'] + \
                    self.configs['endpoint'] + "/users/" + \
                    self.configs['org_id'] + "/" + str(page)
                try:
                    result = self.__submit_request(url)
                    userlist += result.get('users', [])
                    page += 1
                except AdobeAPIBadStatusException:
                    raise
            self.userlist = userlist
        # Update the cache
        if self.cache:
            self.__write_cache()
        return self.userlist