Updated gam <UserTypeEntity> delete|modify messages

to improve the handling
of the following error.
```
quotaExceeded - User-rate limit exceeded
```
This commit is contained in:
Ross Scroggs
2025-08-15 14:55:38 -07:00
parent 8bbb9b6e85
commit a1000f7778
4 changed files with 33 additions and 9 deletions

View File

@@ -1,4 +1,12 @@
7.10.05 7.18.06
Updated `gam <UserTypeEntity> delete|modify messages` to improve the handling
of the following error.
```
quotaExceeded - User-rate limit exceeded
```
7.18.05
Added support for Inbound SSO OIDC profiles. Added support for Inbound SSO OIDC profiles.
@@ -6,6 +14,8 @@ Currently, if you enter `gam select <SectionName>` and nothing else on the comma
GAM performs no action. Now, it will be treated as if you entered: GAM performs no action. Now, it will be treated as if you entered:
`gam select <SectionName> save` `gam select <SectionName> save`
Updated to Python 3.13.7.
7.18.04 7.18.04
Added commands to display/manage Alert Center Pub/Sub notifications. Added commands to display/manage Alert Center Pub/Sub notifications.

View File

@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
""" """
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>' __author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
__version__ = '7.18.05' __version__ = '7.18.06'
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)' __license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
#pylint: disable=wrong-import-position #pylint: disable=wrong-import-position
@@ -44905,10 +44905,10 @@ def getUserLicenses(lic, user, skus):
if exception is None: if exception is None:
if response and 'skuId' in response: if response and 'skuId' in response:
licenses.append(response['skuId']) licenses.append(response['skuId'])
del(sku_calls[request_id]) del sku_calls[request_id]
else: else:
if exception.reason == not_found: if exception.reason == not_found:
del(sku_calls[request_id]) del sku_calls[request_id]
not_found = 'User does not have a license for specified sku and product' not_found = 'User does not have a license for specified sku and product'
licenses = [] licenses = []
@@ -71292,7 +71292,7 @@ def _processMessagesThreads(users, entityType):
try: try:
callGAPI(gmail.users().messages(), function, callGAPI(gmail.users().messages(), function,
throwReasons=GAPI.GMAIL_THROW_REASONS+[GAPI.INVALID_MESSAGE_ID, GAPI.INVALID, GAPI.INVALID_ARGUMENT, throwReasons=GAPI.GMAIL_THROW_REASONS+[GAPI.INVALID_MESSAGE_ID, GAPI.INVALID, GAPI.INVALID_ARGUMENT,
GAPI.FAILED_PRECONDITION, GAPI.PERMISSION_DENIED], GAPI.FAILED_PRECONDITION, GAPI.PERMISSION_DENIED, GAPI.QUOTA_EXCEEDED],
userId='me', body=body) userId='me', body=body)
for messageId in body['ids']: for messageId in body['ids']:
mcount += 1 mcount += 1
@@ -71302,7 +71302,7 @@ def _processMessagesThreads(users, entityType):
csvPF.WriteRow({'User': user, entityHeader: messageId, 'action': Act.Performed()}) csvPF.WriteRow({'User': user, entityHeader: messageId, 'action': Act.Performed()})
except GAPI.serviceNotAvailable: except GAPI.serviceNotAvailable:
mcount += bcount mcount += bcount
except (GAPI.invalid, GAPI.invalidArgument, GAPI.permissionDenied) as e: except (GAPI.invalid, GAPI.invalidArgument, GAPI.permissionDenied, GAPI.quotaExceeded) as e:
_processMessageFailed(user, idsList, f'{str(e)} ({mcount+1}-{mcount+bcount}/{jcount})') _processMessageFailed(user, idsList, f'{str(e)} ({mcount+1}-{mcount+bcount}/{jcount})')
mcount += bcount mcount += bcount
except GAPI.invalidMessageId: except GAPI.invalidMessageId:
@@ -71315,7 +71315,8 @@ def _processMessagesThreads(users, entityType):
_GMAIL_ERROR_REASON_TO_MESSAGE_MAP = {GAPI.NOT_FOUND: Msg.DOES_NOT_EXIST, _GMAIL_ERROR_REASON_TO_MESSAGE_MAP = {GAPI.NOT_FOUND: Msg.DOES_NOT_EXIST,
GAPI.INVALID_MESSAGE_ID: Msg.INVALID_MESSAGE_ID, GAPI.INVALID_MESSAGE_ID: Msg.INVALID_MESSAGE_ID,
GAPI.FAILED_PRECONDITION: Msg.FAILED_PRECONDITION} GAPI.FAILED_PRECONDITION: Msg.FAILED_PRECONDITION,
GAPI.QUOTA_EXCEEDED: Msg.QUOTA_EXCEEDED}
def _callbackProcessMessage(request_id, _, exception): def _callbackProcessMessage(request_id, _, exception):
ri = request_id.splitlines() ri = request_id.splitlines()
@@ -71326,7 +71327,9 @@ def _processMessagesThreads(users, entityType):
csvPF.WriteRow({'User': ri[RI_ENTITY], entityHeader: ri[RI_ITEM], 'action': Act.Performed()}) csvPF.WriteRow({'User': ri[RI_ENTITY], entityHeader: ri[RI_ITEM], 'action': Act.Performed()})
else: else:
http_status, reason, message = checkGAPIError(exception) http_status, reason, message = checkGAPIError(exception)
_processMessageFailed(ri[RI_ENTITY], ri[RI_ITEM], getHTTPError(_GMAIL_ERROR_REASON_TO_MESSAGE_MAP, http_status, reason, message), int(ri[RI_J]), int(ri[RI_JCOUNT])) _processMessageFailed(ri[RI_ENTITY], ri[RI_ITEM],
getHTTPError(_GMAIL_ERROR_REASON_TO_MESSAGE_MAP, http_status, reason, message),
int(ri[RI_J]), int(ri[RI_JCOUNT]))
def _batchProcessMessagesThreads(service, function, user, jcount, messageIds, **kwargs): def _batchProcessMessagesThreads(service, function, user, jcount, messageIds, **kwargs):
svcargs = dict([('userId', 'me'), ('id', None), ('fields', '')]+list(kwargs.items())+GM.Globals[GM.EXTRA_ARGS_LIST]) svcargs = dict([('userId', 'me'), ('id', None), ('fields', '')]+list(kwargs.items())+GM.Globals[GM.EXTRA_ARGS_LIST])
@@ -71424,7 +71427,9 @@ def _processMessagesThreads(users, entityType):
continue continue
if parameters['messageEntity'] is None: if parameters['messageEntity'] is None:
if parameters['maxToProcess'] and jcount > parameters['maxToProcess']: if parameters['maxToProcess'] and jcount > parameters['maxToProcess']:
entityNumEntitiesActionNotPerformedWarning([Ent.USER, user], entityType, jcount, Msg.COUNT_N_EXCEEDS_MAX_TO_PROCESS_M.format(jcount, Act.ToPerform(), parameters['maxToProcess']), i, count) entityNumEntitiesActionNotPerformedWarning([Ent.USER, user], entityType, jcount,
Msg.COUNT_N_EXCEEDS_MAX_TO_PROCESS_M.format(jcount, Act.ToPerform(), parameters['maxToProcess']),
i, count)
continue continue
if not parameters['doIt']: if not parameters['doIt']:
entityNumEntitiesActionNotPerformedWarning([Ent.USER, user], entityType, jcount, Msg.USE_DOIT_ARGUMENT_TO_PERFORM_ACTION, i, count) entityNumEntitiesActionNotPerformedWarning([Ent.USER, user], entityType, jcount, Msg.USE_DOIT_ARGUMENT_TO_PERFORM_ACTION, i, count)

View File

@@ -465,6 +465,7 @@ PROCESSING_ITEM_N = '{0},0,Processing item {1}\n'
PROCESSING_ITEM_N_OF_M = '{0},0,Processing item {1}/{2}\n' PROCESSING_ITEM_N_OF_M = '{0},0,Processing item {1}/{2}\n'
PROFILE_PHOTO_NOT_FOUND = 'Profile photo not found' PROFILE_PHOTO_NOT_FOUND = 'Profile photo not found'
PROFILE_PHOTO_IS_DEFAULT = 'Profile photo is default' PROFILE_PHOTO_IS_DEFAULT = 'Profile photo is default'
QUOTA_EXCEEDED = 'Quota exceeded'
REASON_ONLY_VALID_WITH_CONTENTRESTRICTIONS_READONLY_TRUE = 'reason only valid with contentrestrictions readonly true' REASON_ONLY_VALID_WITH_CONTENTRESTRICTIONS_READONLY_TRUE = 'reason only valid with contentrestrictions readonly true'
REAUTHENTICATION_IS_NEEDED = 'Reauthentication is needed, please run\n\ngam oauth create' REAUTHENTICATION_IS_NEEDED = 'Reauthentication is needed, please run\n\ngam oauth create'
RECOMMEND_RUNNING_GAM_ROTATE_SAKEY = 'Recommend running "gam rotate sakey" to get a new key\n' RECOMMEND_RUNNING_GAM_ROTATE_SAKEY = 'Recommend running "gam rotate sakey" to get a new key\n'

View File

@@ -10,6 +10,14 @@ Add the `-s` option to the end of the above commands to suppress creating the `g
See [Downloads-Installs-GAM7](https://github.com/GAM-team/GAM/wiki/Downloads-Installs) for Windows or other options, including manual installation See [Downloads-Installs-GAM7](https://github.com/GAM-team/GAM/wiki/Downloads-Installs) for Windows or other options, including manual installation
### 7.18.06
Updated `gam <UserTypeEntity> delete|modify messages` to improve the handling
of the following error.
```
quotaExceeded - User-rate limit exceeded
```
### 7.18.05 ### 7.18.05
Added support for Inbound SSO OIDC profiles. Added support for Inbound SSO OIDC profiles.