diff --git a/docs/GamUpdates.md b/docs/GamUpdates.md index 517182bb..c508e0dc 100644 --- a/docs/GamUpdates.md +++ b/docs/GamUpdates.md @@ -10,6 +10,16 @@ Add the `-s` option to the end of the above commands to suppress creating the `g See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation. +### 6.63.12 + +Updated commands that call the Reports API (including `gam info domain`) to handle a change +in the Reports API that generated the following warning: +``` +WARNING: End date greater than LastReportedDate. +``` + +Added option `showdeleted []' to `gam print|show chatmessages`. + ### 6.63.11 Added option `ou_and_children ` to `gam print|show crostelemetry` to simplify getting diff --git a/docs/How-to-Upgrade-from-Standard-GAM.md b/docs/How-to-Upgrade-from-Standard-GAM.md index 106b1b85..68d38964 100644 --- a/docs/How-to-Upgrade-from-Standard-GAM.md +++ b/docs/How-to-Upgrade-from-Standard-GAM.md @@ -330,7 +330,7 @@ writes the credentials into the file oauth2.txt. admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found -GAMADV-XTD3 6.63.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.63.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.10.8 64-bit final MacOS High Sierra 10.13.6 x86_64 @@ -972,7 +972,7 @@ writes the credentials into the file oauth2.txt. C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt C:\GAMADV-XTD3>gam version WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found -GAMADV-XTD3 6.63.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.63.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.11.5 64-bit final Windows-10-10.0.17134 AMD64 diff --git a/docs/Version-and-Help.md b/docs/Version-and-Help.md index cbe4d493..22599621 100644 --- a/docs/Version-and-Help.md +++ b/docs/Version-and-Help.md @@ -3,7 +3,7 @@ Print the current version of Gam with details ``` gam version -GAMADV-XTD3 6.63.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.63.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.11.5 64-bit final MacOS Monterey 12.6.6 x86_64 @@ -15,7 +15,7 @@ Time: 2023-06-02T21:10:00-07:00 Print the current version of Gam with details and time offset information ``` gam version timeoffset -GAMADV-XTD3 6.63.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.63.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.11.5 64-bit final MacOS Monterey 12.6.6 x86_64 @@ -27,7 +27,7 @@ Your system time differs from www.googleapis.com by less than 1 second Print the current version of Gam with extended details and SSL information ``` gam version extended -GAMADV-XTD3 6.63.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.63.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.11.5 64-bit final MacOS Monterey 12.6.6 x86_64 @@ -64,7 +64,7 @@ MacOS High Sierra 10.13.6 x86_64 Path: /Users/Admin/bin/gamadv-xtd3 Version Check: Current: 5.35.08 - Latest: 6.63.11 + Latest: 6.63.12 echo $? 1 ``` @@ -72,7 +72,7 @@ echo $? Print the current version number without details ``` gam version simple -6.63.11 +6.63.12 ``` In Linux/MacOS you can do: ``` @@ -82,7 +82,7 @@ echo $VER Print the current version of Gam and address of this Wiki ``` gam help -GAM 6.63.11 - https://github.com/taers232c/GAMADV-XTD3 +GAM 6.63.12 - https://github.com/taers232c/GAMADV-XTD3 Ross Scroggs Python 3.11.5 64-bit final MacOS Monterey 12.6.6 x86_64 diff --git a/src/GamCommands.txt b/src/GamCommands.txt index 518d0a31..590582dc 100644 --- a/src/GamCommands.txt +++ b/src/GamCommands.txt @@ -5780,10 +5780,10 @@ gam delete chatmessage name gam info chatmessage name [formatjson] gam show chatmessages - [filter ] + [showdeleted []] [filter ] [formatjson] gam print chatmessages [todrive *] - [filter ] + [showdeleted []] [filter ] [formatjson [quotechar ]] # Users - Data Studuo diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index 144400fc..2a8f7f0b 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -2,6 +2,16 @@ Merged GAM-Team version +6.63.12 + +Updated commands that call the Reports API (including `gam info domain`) to handle a change +in the Reports API that generated the following warning: +``` +WARNING: End date greater than LastReportedDate. +``` + +Added option `showdeleted []' to `gam print|show chatmessages`. + 6.63.11 Added option `ou_and_children ` to `gam print|show crostelemetry` to simplify getting diff --git a/src/gam/__init__.py b/src/gam/__init__.py index f02ac5ea..09e47b3a 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -12479,14 +12479,23 @@ def doWhatIs(): entityUnknownWarning(Ent.EMAIL, email) setSysExitRC(ENTITY_IS_UKNOWN_RC) -def _adjustTryDate(errMsg, noDateChange): +def _adjustTryDate(errMsg, noDateChange, prevTryDate): match_date = re.match('Data for dates later than (.*) is not yet available. Please check back later', errMsg) - if not match_date: + if match_date: + tryDate = match_date.group(1) + else: match_date = re.match('Start date can not be later than (.*)', errMsg) + if match_date: + tryDate = match_date.group(1) + else: + match_date = re.match('End date greater than LastReportedDate.', errMsg) + if match_date: + tryDateTime = datetime.datetime.strptime(prevTryDate, YYYYMMDD_FORMAT)-datetime.timedelta(days=1) + tryDate = tryDateTime.strftime(YYYYMMDD_FORMAT) if (not match_date) or noDateChange: printWarningMessage(DATA_NOT_AVALIABLE_RC, errMsg) return None - return match_date.group(1) + return tryDate def _checkDataRequiredServices(result, tryDate, dataRequiredServices, parameterServices=None, checkUserEmail=False): # -1: Data not available: @@ -12594,7 +12603,7 @@ def doReportUsageParameters(): printErrorMessage(BAD_REQUEST_RC, Msg.BAD_REQUEST) return except GAPI.invalid as e: - tryDate = _adjustTryDate(str(e), False) + tryDate = _adjustTryDate(str(e), False, tryDate) if not tryDate: break for parameter in sorted(allParameters): @@ -13373,7 +13382,7 @@ def doReport(): if not status: break except GAPI.invalid as e: - tryDate = _adjustTryDate(str(e), noDateChange) + tryDate = _adjustTryDate(str(e), noDateChange, tryDate) if not tryDate: break startDateTime = endDateTime = datetime.datetime.strptime(tryDate, YYYYMMDD_FORMAT) @@ -13450,7 +13459,7 @@ def doReport(): if not status: break except GAPI.invalid as e: - tryDate = _adjustTryDate(str(e), noDateChange) + tryDate = _adjustTryDate(str(e), noDateChange, tryDate) if not tryDate: break startDateTime = endDateTime = datetime.datetime.strptime(tryDate, YYYYMMDD_FORMAT) @@ -15338,7 +15347,7 @@ def _showCustomerLicenseInfo(customerInfo, FJQC): continue break except GAPI.invalid as e: - tryDate = _adjustTryDate(str(e), False) + tryDate = _adjustTryDate(str(e), False, tryDate) if not tryDate: return continue @@ -25265,10 +25274,10 @@ def doInfoChatMessage(): infoChatMessage([None]) # gam show chatmessages -# [filter ] +# [showdeleted []] [filter ] # [formatjson] # gam print chatmessages [todrive *] i -# [filter ] +# [showdeleted []] [filter ] # [formatjson [quotechar ]] def printShowChatMessages(users): def _printChatMessage(user, message): @@ -25289,12 +25298,15 @@ def printShowChatMessages(users): csvPF = CSVPrintFile(['User', 'name'] if not isinstance(users, list) else ['name']) if Act.csvFormat() else None FJQC = FormatJSONQuoteChar(csvPF) parent = pfilter = None + showDeleted = False while Cmd.ArgumentsRemaining(): myarg = getArgument() if csvPF and myarg == 'todrive': csvPF.GetTodriveParameters() elif myarg == 'space' or myarg.startswith('spaces/'): parent = getChatSpace(myarg) + elif myarg == 'showdeleted': + showDeleted = getBoolean() elif myarg =='filter': pfilter = getString(Cmd.OB_STRING) else: @@ -25314,9 +25326,10 @@ def printShowChatMessages(users): messages = callGAPIpages(chat.spaces().messages(), 'list', 'messages', pageMessage=_getChatPageMessage(Ent.CHAT_MESSAGE, user, i, count, qfilter), throwReasons=[GAPI.NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.PERMISSION_DENIED], - pageSize=CHAT_PAGE_SIZE, parent=parent, filter=pfilter) + pageSize=CHAT_PAGE_SIZE, parent=parent, filter=pfilter, showDeleted=showDeleted) for message in messages: - _getChatSenderEmail(cd, message['sender']) + if 'sender' in message: + _getChatSenderEmail(cd, message['sender']) except (GAPI.notFound, GAPI.invalidArgument, GAPI.permissionDenied) as e: exitIfChatNotConfigured(chat, kvList, str(e), i, count) continue