from lookerapi import LookerApi
import csv

f = open('config.yml')
params = yaml.load(f)
f.close()

host = 'localhost'

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)

all_users = looker.get_user()
user_attributes = looker.get_user_attributes()

writer = csv.writer(open('user-attributes.csv', 'w'),
                    delimiter=',',
                    quotechar='"',
                    quoting=csv.QUOTE_MINIMAL,
                    lineterminator='\n')
headers = ['group_ids']
for attribute in user_attributes:
    headers.append(attribute['name'])

writer.writerow(headers)

for u in all_users:
    values = []
host = 'teach'

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)


me = looker.get_current_user()['id']
# print(me)

all_users =  looker.get_user()
ids_to_disable = []
# print(all_users)

days_to_disable = 30

no_login_count = 0
good_user_count = 0
errors = 0
looker_user_count = 0


for u in all_users:
	login = None
	uid = u['id']
	# print(u)