mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 12:21:35 +00:00
fix gam info counts
This commit is contained in:
@@ -69,19 +69,27 @@ def doGetCustomerInfo():
|
|||||||
throw_reasons = [gapi.errors.ErrorReason.INVALID]
|
throw_reasons = [gapi.errors.ErrorReason.INVALID]
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
usage = gapi.get_all_pages(rep.customerUsageReports(),
|
result = gapi.call(rep.customerUsageReports(),
|
||||||
'get',
|
'get',
|
||||||
'usageReports',
|
throw_reasons=throw_reasons,
|
||||||
throw_reasons=throw_reasons,
|
customerId=customerId,
|
||||||
customerId=customerId,
|
date=tryDate,
|
||||||
date=tryDate,
|
parameters=parameters)
|
||||||
parameters=parameters)
|
|
||||||
break
|
|
||||||
except gapi.errors.GapiInvalidError as e:
|
except gapi.errors.GapiInvalidError as e:
|
||||||
tryDate = gapi_reports._adjust_date(str(e))
|
tryDate = gapi_reports._adjust_date(str(e))
|
||||||
if not usage:
|
continue
|
||||||
print('No user count data available.')
|
warnings = result.get('warnings', [])
|
||||||
return
|
fullDataRequired = ['accounts']
|
||||||
|
usage = result.get('usageReports')
|
||||||
|
has_reports = bool(usage)
|
||||||
|
fullData, tryDate = gapi_reports._check_full_data_available(
|
||||||
|
warnings, tryDate, fullDataRequired, has_reports)
|
||||||
|
if fullData < 0:
|
||||||
|
print('No user report available.')
|
||||||
|
sys.exit(1)
|
||||||
|
if fullData == 0:
|
||||||
|
continue
|
||||||
|
break
|
||||||
print(f'User counts as of {tryDate}:')
|
print(f'User counts as of {tryDate}:')
|
||||||
for item in usage[0]['parameters']:
|
for item in usage[0]['parameters']:
|
||||||
api_name = user_counts_map.get(item['name'])
|
api_name = user_counts_map.get(item['name'])
|
||||||
|
|||||||
Reference in New Issue
Block a user