-
-
Save nmcspadden/b25acfe0f4ca92f3525d4fb07b0c36ec to your computer and use it in GitHub Desktop.
adobe_tools - Get all users of a product config (internal)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _users_of_product(config_data, product_config_name, access_token): | |
"""Get a list of users of a specific configuration.""" | |
page = 0 | |
result = {} | |
userlist = [] | |
while result.get('lastPage', False) is not True: | |
url = "https://" + config_data['host'] + config_data['endpoint'] + \ | |
"/users/" + config_data['org_id'] + "/" + str(page) + "/" + \ | |
quote(product_config_name) | |
res = requests.get(url, headers=headers(config_data, access_token)) | |
if res.status_code == 200: | |
# print(res.status_code) | |
# print(res.headers) | |
# print(res.text) | |
result = json.loads(res.text) | |
userlist += result.get('users', []) | |
page += 1 | |
return userlist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment