Skip to content

Instantly share code, notes, and snippets.

@cundi cundi/
Created Jan 8, 2018

What would you like to do?
demo for delete kandy user
huatang_DAK = xxx
huatang_DAS = xxx
def get_dat(dak, das):
Domain access token
url = api_host + '/v1.3/domains/accessTokens?key={0}&domain_api_secret={1}'.format(dak, das)
r = get(url)
DAT = r.json()['result']['domain_access_token']
return DAT
def get_domain_users(dak, das):
Get a list of Users for a Domain
url = api_host + '/v1.3/domains/users?key={DAT}'.format(DAT=get_dat(dak, das))
r = get(url)
resp = r.json()
return resp
def delete_domain_users():
url = '{0}&user_api_key={1}'
raw_users = get_domain_users(huatang_DAK, huatang_DAS)
users = raw_users.get('result').get('users')
headers = {'content-type': 'application/json'}
DAT = get_dat(huatang_DAK, huatang_DAS)
for i in users:
uak = i['user_api_key']
response = delete(url.format(DAT, uak), headers=headers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.