From 30fea18f938cc576af5f581cca470d7d59a5bc74 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Fri, 15 Aug 2025 14:50:53 +0000 Subject: [PATCH] Add more reasons why user info license errored --- src/gam/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gam/__init__.py b/src/gam/__init__.py index f55ceb64..bc4c10f3 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -44907,10 +44907,15 @@ def getUserLicenses(lic, user, skus): licenses.append(response['skuId']) del(sku_calls[request_id]) else: - if exception.reason == not_found: + _, reason, _ = checkGAPIError(exception, softErrors=True) + if reason in reasons_to_quit: del(sku_calls[request_id]) - not_found = 'User does not have a license for specified sku and product' + reasons_to_quit = [ + GAPI.ACCESS_NOT_CONFIGURED, # license API not turned on + GAPI.PERMISSION_DENIED, # Admin doesn't have rights to license assignments + GAPI.NOT_FOUND # API call succeeded, user does not have this license + ] licenses = [] svcargs = dict([('userId', user['primaryEmail']), ('productId', None), ('skuId', None), ('fields', 'skuId')]+GM.Globals[GM.EXTRA_ARGS_LIST]) method = getattr(lic.licenseAssignments(), 'get')