Clean up new batch licensing (#370)

This commit is contained in:
Ross Scroggs
2016-12-27 08:49:37 -08:00
committed by Jay Lee
parent 4817ce282a
commit 2b57a976c2

View File

@ -7674,6 +7674,11 @@ def doWhatIs():
doGetAliasInfo(alias_email=email)
def doGetUserInfo(user_email=None):
def user_lic_result(request_id, response, exception):
if response and u'skuId' in response:
user_licenses.append(response[u'skuId'])
cd = buildGAPIObject(u'directory')
i = 3
if user_email is None:
@ -7893,21 +7898,15 @@ def doGetUserInfo(user_email=None):
if getLicenses:
print u'Licenses:'
lic = buildGAPIObject(u'licensing')
lbatch = googleapiclient.http.BatchHttpRequest()
global user_licenses
lbatch = googleapiclient.http.BatchHttpRequest(callback=user_lic_result)
user_licenses = []
for sku in skus:
productId, skuId = getProductAndSKU(sku)
lbatch.add(lic.licenseAssignments().get(userId=user_email, productId=productId, skuId=skuId), callback=user_lic_result)
lbatch.add(lic.licenseAssignments().get(userId=user_email, productId=productId, skuId=skuId))
lbatch.execute()
for user_license in user_licenses:
print ' %s' % user_license
def user_lic_result(request_id, response, exception):
if response and u'skuId' in response:
global user_licenses
user_licenses.append(response[u'skuId'])
def doGetGroupInfo(group_name=None):
cd = buildGAPIObject(u'directory')
gs = buildGAPIObject(u'groupssettings')