handle SA Drive auth failure on CSV Sheets better

This commit is contained in:
Jay Lee
2017-10-11 14:57:38 -04:00
parent 63ca5f8054
commit c98473d118

View File

@ -9755,7 +9755,15 @@ def writeCSVfile(csvRows, titles, list_type, todrive):
if cell_count > 2000000 or columns > 256:
print u'{0}{1}'.format(WARNING_PREFIX, MESSAGE_RESULTS_TOO_LARGE_FOR_GOOGLE_SPREADSHEET)
mimeType = u'text/csv'
_, drive = buildDrive3GAPIObject(_getValueFromOAuth(u'email'))
admin_email = _getValueFromOAuth(u'email')
_, drive = buildDrive3GAPIObject(admin_email)
if not drive:
print u'''\nGAM is not authorized to create Drive files. Please run:
gam user %s check serviceaccount
and follow recommend steps to authorize GAM for Drive access.''' % (admin_email)
sys.exit(5)
body = {u'description': u' '.join(sys.argv),
u'name': u'%s - %s' % (GC_Values[GC_DOMAIN], list_type),
u'mimeType': mimeType}