From fac8c11798856666e519248673e81f283ecba9fc Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Mon, 13 Nov 2023 16:59:11 -0800 Subject: [PATCH] Updated `gam get drivefile ` to handle the following error that seems to occur when multiple tabs from a Google sheet are being downloaded in parallel. ``` Download Failed: HTTP Error: 429 ``` --- docs/GamUpdates.md | 8 ++++++++ docs/How-to-Upgrade-from-Standard-GAM.md | 4 ++-- docs/Users.md | 8 +++++++- docs/Version-and-Help.md | 12 ++++++------ src/GamCommands.txt | 4 ++++ src/GamUpdate.txt | 10 +++++++++- src/gam/__init__.py | 11 +++++++++-- 7 files changed, 45 insertions(+), 12 deletions(-) diff --git a/docs/GamUpdates.md b/docs/GamUpdates.md index b9430c26..ec4e52d3 100644 --- a/docs/GamUpdates.md +++ b/docs/GamUpdates.md @@ -10,6 +10,14 @@ 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.65.09 + +Updated `gam get drivefile ` to handle the following error +that seems to occur when multiple tabs from a Google sheet are being downloaded in parallel. +``` +Download Failed: HTTP Error: 429 +``` + ### 6.65.08 Added option `addcsvdata ` to `gam report ` that adds diff --git a/docs/How-to-Upgrade-from-Standard-GAM.md b/docs/How-to-Upgrade-from-Standard-GAM.md index a1e9c2eb..e41e1e19 100644 --- a/docs/How-to-Upgrade-from-Standard-GAM.md +++ b/docs/How-to-Upgrade-from-Standard-GAM.md @@ -334,7 +334,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.65.08 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.65.09 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.10.8 64-bit final MacOS High Sierra 10.13.6 x86_64 @@ -1002,7 +1002,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.65.08 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.65.09 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.0 64-bit final Windows-10-10.0.17134 AMD64 diff --git a/docs/Users.md b/docs/Users.md index 7f4bb8d1..303cb680 100644 --- a/docs/Users.md +++ b/docs/Users.md @@ -371,7 +371,8 @@ When creating a user or updating a user's password, you can send a message with [subject ] [notifypassword ] [from ] - [replyto ] + [mailbox ] + [replyto ] [] (replace )*] [notifyonupdate []] @@ -420,6 +421,7 @@ is sent when the user is updated or created. Use `notifyonupdate false` to suppr By default, the email is sent from the admin user identified in oauth2.txt, `gam oauth info` will show the value. Use `from ` to specify an alternate from address. +Use `mailbox ` if `from ` specifies a group; GAM has to login as a user to be able to send a message. Gam gets no indication as to the status of the message delivery; the from user will get a non-delivery receipt if the message could not be sent to the `notify `. By default, messages are sent as plain text, use `html` or `html true` to indicate that the message is HTML. @@ -494,6 +496,7 @@ gam create user [ignorenullpassword] * [subject ] [notifypassword ] [from ] + [mailbox ] [replyto ] [] (replace )*] @@ -605,6 +608,7 @@ gam update user [ignorenullpassword] * [subject ] [notifypassword ] [from ] + [mailbox ] [replyto ] [] (replace )*] @@ -625,6 +629,7 @@ gam update users [ignorenullpassword] * [subject ] [notifypassword ] [from ] + [mailbox ] [replyto ] [] (replace )*] @@ -645,6 +650,7 @@ gam update users [ignorenullpassword] * [subject ] [notifypassword ] [from ] + [mailbox ] [replyto ] [] (replace )*] diff --git a/docs/Version-and-Help.md b/docs/Version-and-Help.md index 11b11d2a..ef0c5a10 100644 --- a/docs/Version-and-Help.md +++ b/docs/Version-and-Help.md @@ -4,7 +4,7 @@ Print the current version of Gam with details ``` gam version -GAMADV-XTD3 6.65.08 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.65.09 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.0 64-bit final MacOS Monterey 12.7 x86_64 @@ -16,7 +16,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.65.08 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.65.09 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.0 64-bit final MacOS Monterey 12.7 x86_64 @@ -28,7 +28,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.65.08 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.65.09 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.0 64-bit final MacOS Monterey 12.7 x86_64 @@ -65,7 +65,7 @@ MacOS High Sierra 10.13.6 x86_64 Path: /Users/Admin/bin/gamadv-xtd3 Version Check: Current: 5.35.08 - Latest: 6.65.08 + Latest: 6.65.09 echo $? 1 ``` @@ -73,7 +73,7 @@ echo $? Print the current version number without details ``` gam version simple -6.65.08 +6.65.09 ``` In Linux/MacOS you can do: ``` @@ -83,7 +83,7 @@ echo $VER Print the current version of Gam and address of this Wiki ``` gam help -GAM 6.65.08 - https://github.com/taers232c/GAMADV-XTD3 +GAM 6.65.09 - https://github.com/taers232c/GAMADV-XTD3 Ross Scroggs Python 3.12.0 64-bit final MacOS Monterey 12.7 x86_64 diff --git a/src/GamCommands.txt b/src/GamCommands.txt index 3d7d631b..df688960 100644 --- a/src/GamCommands.txt +++ b/src/GamCommands.txt @@ -5168,6 +5168,7 @@ gam create|add user [ignorenullpassword] * [subject ] [notifypassword ] [from ] + [mailbox ] [replyto ] [] (replace )*] @@ -5191,6 +5192,7 @@ gam update user [ignorenullpassword] * [subject ] [notifypassword ] [from ] + [mailbox ] [replyto ] [] (replace )*] @@ -5225,6 +5227,7 @@ gam update users [ignorenullpassword] * [subject ] [notifypassword ] [from ] + [mailbox ] [] (replace )*] [notifyonupdate []] [setchangepasswordoncreate []] @@ -5257,6 +5260,7 @@ gam update users [ignorenullpassword] * [subject ] [notifypassword ] [from ] + [mailbox ] [] (replace )*] [notifyonupdate []] [setchangepasswordoncreate []] diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index c7bed1a3..c9e18d13 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -2,6 +2,14 @@ Merged GAM-Team version +6.65.09 + +Updated `gam get drivefile ` to handle the following error +that seems to occur when multiple tabs from a Google sheet are being downloaded in parallel. +``` +Download Failed: HTTP Error: 429 +``` + 6.65.08 Added option `addcsvdata ` to `gam report ` that adds @@ -5156,7 +5164,7 @@ Updated `gam [] create teamdrive ` to output the name of t Team Drive in addition to its ID. ``` $ gam user user@domain.com create teamdrive Test -User: user@domain.com, Shared Drive Name: Test, Shared Drive ID: 0ALHCDtCDTx_4Uk9PVA, Created +User: user@domain.com, Shared Drive Name: Test, Shared Drive ID: 0ALHCDtCDTx_4Uk9XYZ, Created ``` 6.03.20 diff --git a/src/gam/__init__.py b/src/gam/__init__.py index d153737d..6265da61 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -56966,7 +56966,14 @@ def getDriveFile(users): else: if GC.Values[GC.DEBUG_LEVEL] > 0: sys.stderr.write(f'Debug: spreadsheetUrl: {spreadsheetUrl}\n') - status, content = drive._http.request(uri=spreadsheetUrl, method='GET') + maxRetries = 10 + sleepTime = 5 + for retry in range(1, maxRetries+1): + status, content = drive._http.request(uri=spreadsheetUrl, method='GET') + if status['status'] != '429': + break + writeStderr(Msg.RETRYING_GOOGLE_SHEET_EXPORT_SLEEPING.format(retry, maxRetries, sleepTime)) + time.sleep(sleepTime) if status['status'] == '200': f.write(content) if targetStdout and content[-1] != '\n': @@ -58132,7 +58139,7 @@ def transferOwnership(users): i, count, users = getEntityArgument(users) for user in users: i += 1 - user, drive, jcount = _validateUserGetFileIDs(user, i, count, fileIdEntity, entityType=Ent.DRIVE_FOLDER) + user, drive, jcount = _validateUserGetFileIDs(user, i, count, fileIdEntity, entityType=Ent.DRIVE_FILE_OR_FOLDER) if jcount == 0: continue if filepath: