From 0e5635cc2a413aea603755532d84dc0e98c8ad20 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Thu, 18 Jun 2020 11:17:46 -0400 Subject: [PATCH] fix project creation for @gmail.com accounts --- src/gam/__init__.py | 16 ++++++++++------ src/gam/gapi/errors.py | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/gam/__init__.py b/src/gam/__init__.py index c90b3496..cfbc547d 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -7306,12 +7306,15 @@ def setGAMProjectConsentScreen(httpObj, projectId, login_hint): print('Setting GAM project consent screen...') iap = getService('iap', httpObj) body = {'applicationTitle': 'GAM', 'supportEmail': login_hint} + throw_reasons = [ + gapi_errors.ErrorReason.FOUR_O_NINE, gapi_errors.ErrorReason.FOUR_O_O + ] try: gapi.call(iap.projects().brands(), 'create', parent=f'projects/{projectId}', body=body, - throw_reasons=[gapi_errors.ErrorReason.FOUR_O_NINE]) + throw_reasons=throw_reasons) except googleapiclient.errors.HttpError: pass @@ -13390,11 +13393,12 @@ def ProcessGAMCommand(args): f'Here are the first {num_items} commands GAM will run (note that quoting may be lost/invalid in this output):\n' ) for i in range(num_items): - c = ' '.join([item if (item and - (item.find(' ') == -1) and - (item.find(',') == -1) and - (item.find("'") == -1)) - else '"'+item+'"' for item in items[i]]) + c = ' '.join([ + item if (item and (item.find(' ') == -1) and + (item.find(',') == -1) and + (item.find("'") == -1)) else '"' + item + '"' + for item in items[i] + ]) print(f' {c}') sys.exit(0) elif command == 'version': diff --git a/src/gam/gapi/errors.py b/src/gam/gapi/errors.py index 9a985aa9..e940bf11 100644 --- a/src/gam/gapi/errors.py +++ b/src/gam/gapi/errors.py @@ -117,6 +117,7 @@ class ErrorReason(Enum): FAILED_PRECONDITION = 'failedPrecondition' FORBIDDEN = 'forbidden' FOUR_O_NINE = '409' + FOUR_O_O = '400' FOUR_O_THREE = '403' FOUR_TWO_NINE = '429' GATEWAY_TIMEOUT = 'gatewayTimeout'