Created
November 30, 2018 16:50
-
-
Save marcusrehm/0c0e73d9b3292bbcf45e2304f722f5f6 to your computer and use it in GitHub Desktop.
Databricks - Groups and Users admin
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
import requests | |
import base64 | |
DOMAIN = '' | |
TOKEN = b'' | |
user_name = "" | |
parent_name = "data-engineers" | |
response = requests.post( | |
'https://%s/api/2.0/groups/add-member' % (DOMAIN), | |
headers={'Authorization': b"Basic " + base64.standard_b64encode(b"token:" + TOKEN)}, | |
json={ | |
"user_name" : user_name, | |
"parent_name" : parent_name | |
} | |
) | |
print(response.json()) |
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
import requests | |
import base64 | |
DOMAIN = '' | |
TOKEN = b'' | |
group_name = "data-analysts" | |
response = requests.post( | |
'https://%s/api/2.0/groups/create' % (DOMAIN), | |
headers={'Authorization': b"Basic " + base64.standard_b64encode(b"token:" + TOKEN)}, | |
json={ | |
"group_name": group_name | |
} | |
) | |
print(response.json()) |
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
import requests | |
import base64 | |
DOMAIN = ' | |
TOKEN = b'' | |
group_name = "data-scientists" | |
response = requests.get( | |
'https://%s/api/2.0/groups/list-members' % (DOMAIN), | |
headers={'Authorization': b"Basic " + base64.standard_b64encode(b"token:" + TOKEN)}, | |
json={ | |
"group_name" : group_name | |
} | |
) | |
print(response.json()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment