Handle Google mis-reporting invalid group in gam print groups settings (#342)

This commit is contained in:
Ross Scroggs
2016-11-18 15:32:55 -08:00
committed by Jay Lee
parent 43707d8074
commit ac2eb99d63

View File

@ -9198,11 +9198,11 @@ def doPrintGroups():
group[u'Owners'] = memberDelimiter.join(allOwners) group[u'Owners'] = memberDelimiter.join(allOwners)
if getSettings and not GroupIsAbuseOrPostmaster(groupEmail): if getSettings and not GroupIsAbuseOrPostmaster(groupEmail):
sys.stderr.write(u" Retrieving Settings for group %s (%s/%s)...\r\n" % (groupEmail, i, count)) sys.stderr.write(u" Retrieving Settings for group %s (%s/%s)...\r\n" % (groupEmail, i, count))
try: settings = callGAPI(gs.groups(), u'get',
settings = callGAPI(gs.groups(), u'get', soft_errors=True,
retry_reasons=[u'serviceLimit'], retry_reasons=[u'serviceLimit', u'invalid'],
throw_reasons=[u'invalid'], groupUniqueId=groupEmail, fields=gsfields)
groupUniqueId=groupEmail, fields=gsfields) if settings:
for key in settings: for key in settings:
if key in [u'email', u'name', u'description', u'kind', u'etag']: if key in [u'email', u'name', u'description', u'kind', u'etag']:
continue continue
@ -9212,7 +9212,7 @@ def doPrintGroups():
if key not in titles: if key not in titles:
addTitleToCSVfile(key, titles) addTitleToCSVfile(key, titles)
group[key] = setting_value group[key] = setting_value
except googleapiclient.errors.HttpError: else:
sys.stderr.write(u" Settings unavailable for group %s (%s/%s)...\r\n" % (groupEmail, i, count)) sys.stderr.write(u" Settings unavailable for group %s (%s/%s)...\r\n" % (groupEmail, i, count))
csvRows.append(group) csvRows.append(group)
writeCSVfile(csvRows, titles, u'Groups', todrive) writeCSVfile(csvRows, titles, u'Groups', todrive)