forked from mikeghen/python_api_samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_users_to_group.py
More file actions
35 lines (24 loc) · 763 Bytes
/
add_users_to_group.py
File metadata and controls
35 lines (24 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import yaml ### install the pyyaml package
import json
from lookerapi import LookerApi
from datetime import datetime
from pprint import pprint
### ------- HERE ARE PARAMETERS TO CONFIGURE -------
host = ''
# Users you want to add to a group
user_ids = []
# Group you want to add users to
group_id =
### ------- OPEN THE CONFIG FILE and INSTANTIATE API -------
f = open('config.yml')
params = yaml.load(f)
f.close()
my_host = params['hosts'][host]['host']
my_secret = params['hosts'][host]['secret']
my_token = params['hosts'][host]['token']
looker = LookerApi(host=my_host,
token=my_token,
secret = my_secret)
### ------- OPEN ADD USERS TO A GROUP -------
for i in user_ids:
looker.add_users_to_group(group_id, i)