diff --git a/src/GamCommands.txt b/src/GamCommands.txt index dd662c40..5b6a601c 100644 --- a/src/GamCommands.txt +++ b/src/GamCommands.txt @@ -711,7 +711,7 @@ gam delete|del license gam update photo gam delete|del photo -gam get photo [drivedir|(targetfolder )] +gam get photo [drivedir|(targetfolder )] [noshow] gam profile share|shared|unshare|unshared gam show profile diff --git a/src/gam.py b/src/gam.py index 46d434fb..a2ed4be3 100755 --- a/src/gam.py +++ b/src/gam.py @@ -847,14 +847,7 @@ def waitOnFailure(n, retries, errMsg): if n > 3: sys.stderr.write(u'attempt {0}/{1}\n'.format(n+1, retries)) -class GData_exception(Exception): - def __init__(self, value): - super(GData_exception, self).__init__(value) - self.value = value - def __str__(self): - return repr(self.value) - -class GData_serviceNotApplicable(GData_exception): pass +class GData_serviceNotApplicable(Exception): pass def callGData(service, function, soft_errors=False, throw_errors=[], @@ -934,14 +927,7 @@ def checkGAPIError(e, soft_errors=False, silent_errors=False, retryOnHttpError=F reason = http_status return (http_status, reason, message) -class GAPI_exception(Exception): - def __init__(self, value): - super(GAPI_exception, self).__init__(value) - self.value = value - def __str__(self): - return repr(self.value) - -class GAPI_serviceNotAvailable(GAPI_exception): pass +class GAPI_serviceNotAvailable(Exception): pass def callGAPI(service, function, silent_errors=False, soft_errors=False, throw_reasons=[], retry_reasons=[], diff --git a/src/whatsnew.txt b/src/whatsnew.txt index 44219ba3..9b18ed88 100644 --- a/src/whatsnew.txt +++ b/src/whatsnew.txt @@ -2,170 +2,173 @@ GAM 3.66 See GamCommands.txt for a complete syntax description. Added arguments to gam info group to suppress aliases listing and include groups of which this group is a member. -`gam info group ... [noaliases] [groups]` +gam info group ... [noaliases] [groups] Added argument to gam print cros to limit number of activeTimeRanges and recentUsers entries -`gam print cros ... [listlimit ]` +gam print cros ... [listlimit ] -Added argument to `gam signature` and `gam vacation` to allow specification of file character set so that extended characters can be read. +Added argument to gam signature and gam vacation to allow specification of file character set so that extended characters can be read. Credit to Steve Main for suggesting the following enhancement. -Added argument to `gam signature` and `gam vacation` to allow pattern substitution in the signature and vacation message. -`gam signature |(file [charset ]) (replace )*` -`gam vacation subject (message )|(file [charset ]) (replace )* - [contactsonly] [domainonly] [startdate ] [enddate ]` -Every instance of `{}` in the signature/message will be replaced by ``. Instances of the form `{RT}...{Text}...{/RT}` will be eliminated -if there was no `` specified that matches `Text` or if a `` matching `Text` was specified but the matching `` is empty. +Added argument to gam signature and gam vacation to allow pattern substitution in the signature and vacation message. +gam signature |(file [charset ]) (replace )* +gam vacation subject (message )|(file [charset ]) (replace )* + [contactsonly] [domainonly] [startdate ] [enddate ] +Every instance of {} in the signature/message will be replaced by . Instances of the form {RT}...{Text}...{/RT} will be eliminated +if there was no specified that matches Text or if a matching Text was specified but the matching is empty. This is especially useful with CSV files. -`gam csv Users.csv gam user "~User" signature file SignatureTemplate.txt replace "#User#" "~User" replace "#Title#" "~Title"` +gam csv Users.csv gam user "~User" signature file SignatureTemplate.txt replace "#User#" "~User" replace "#Title#" "~Title" -Added argument to `gam show signature` to format the signature. -`gam show signature [format]` +Added argument to gam show signature to format the signature. +gam show signature [format] Added argument to gam add/update calendar to allow specification of event notifications -`gam add/update calendar notification email|sms eventcreation|eventchange|eventcancellation|eventresponce|agenda` +gam add/update calendar notification email|sms eventcreation|eventchange|eventcancellation|eventresponce|agenda Added option to reminder and notification arguments of update calendar to allowing clearing of reminders/notifications. -`gam update calendar [reminder clear] [notification clear]` +gam update calendar [reminder clear] [notification clear] -Added arguments to `gam print group-members` to allow selecting subsets of groups. -Added argument to `gam print group-members` to add member full name to output, -Added argument to `gam print group-members` to allow output field selection. -`gam print group-members [todrive] ([domain ] [member ])|[group ] [membernames] [fields ]` -`MembersFieldNameList` is a comma separated list of field names: `email | group | id | name | role | type` +Added arguments to gam print group-members to allow selecting subsets of groups. +Added argument to gam print group-members to add member full name to output, +Added argument to gam print group-members to allow output field selection. +gam print group-members [todrive] ([domain ] [member ])|[group ] [membernames] [fields ] +MembersFieldNameList is a comma separated list of field names: email | group | id | name | role | type -Added argument to `gam info user` to specify SKUs for which license information is desired. -`gam info user [] ... [skus ]` +Added argument to gam info user to specify SKUs for which license information is desired. +gam info user [] ... [skus ] -Added argument to `gam print printjobs` and `gam printjob fetch` to allow specifying the maximum number of print jobs to retrieve. -`gam printjob fetch ... [limit ]` -`gam print printjobs ... [limit ]` -`limit ` specifies the maximum number of print jobs to retrieve; defaults to 25, set limit to 0 to retrieve all print jobs. +Added argument to gam print printjobs and gam printjob fetch to allow specifying the maximum number of print jobs to retrieve. +gam printjob fetch ... [limit ] +gam print printjobs ... [limit ] +limit specifies the maximum number of print jobs to retrieve; defaults to 25, set limit to 0 to retrieve all print jobs. Credit to Seth Stein for the following enhancements. -Added argument to `gam get drivefile` to allow downloading a specific revision of a drive file. -`gam get drivefile (id )|(query ) [format ] [targetfolder ] [revision ]` +Added argument to gam get drivefile to allow downloading a specific revision of a drive file. +gam get drivefile (id )|(query ) [format ] [targetfolder ] [revision ] Added command to show drive file revisions. -`gam show filerevisions ` +gam show filerevisions -Added argument to `gam print adminroles` to allow uploading to Google Drive. -`gam print adminroles [todrive]` +Added argument to gam print adminroles to allow uploading to Google Drive. +gam print adminroles [todrive] -Added `group, groups, mobile` arguments to `gam report`. -`gam report admin|calendar|calendars|drive|docs|doc|groups|group|logins|login|mobile|tokens|token ...` +Added group, groups, mobile arguments to gam report. +gam report admin|calendar|calendars|drive|docs|doc|groups|group|logins|login|mobile|tokens|token ... Added command to show user Google+ profile. -`gam show gplusprofile [todrive]` +gam show gplusprofile [todrive] To enable this command, visit: https://github.com/jay0lee/GAM/wiki/CreatingClientSecretsFile In step 3.v, enable the Google+ API -In step 6.iii.d, add `https://www.googleapis.com/auth/plus.me` to the API scopes - Service Account list, then remove and re-add the authorization. +In step 6.iii.d, add https://www.googleapis.com/auth/plus.me to the API scopes - Service Account list, then remove and re-add the authorization. -Added argument to `gam show labels` to allow seeing message counts for each label. -`gam show labels|label [onlyuser] [showcounts]` +Added argument to gam show labels to allow seeing message counts for each label. +gam show labels|label [onlyuser] [showcounts] -Added argument to `gam show fileinfo` to allow field selection. -`gam show fileinfo [allfields|*]` +Added argument to gam show fileinfo to allow field selection. +gam show fileinfo [allfields|*] -Added argument to `gam update group` to allow removing members by role. -`gam update group clear [members] [managers] [owners]` +Added argument to gam update group to allow removing members by role. +gam update group clear [members] [managers] [owners] If no option follows clear, all members will removed. -Changed `gam print admins` to include 'id:' in OrgUnitID column as with other `gam print` commands. +Changed gam print admins to include 'id:' in OrgUnitID column as with other gam print commands. -Fixed GAM to handle both future date error messages in `gam report` +Fixed GAM to handle both future date error messages in gam report -Fixed `gam show delegates` to handle Unicode characters in delagator name. +Fixed gam show delegates to handle Unicode characters in delagator name. -Fixed `gam get drivefile` to properly handle file extension. +Fixed gam get drivefile to properly handle file extension. -Fixed `gam create alias target `. +Fixed gam create alias target . 2016/07/29 Added command to empty drive drive trash. -`gam empty drivetrash` +gam empty drivetrash Added alternative command to add delegates and command to print delegates. -`gam add delegate|delegates ` -`gam print delegates [todrive]` +gam add delegate|delegates +gam print delegates [todrive] Improved Gmail filter processing. -`gam [add] filter [from ] [to ] [subject ] [haswords|query ] [nowords|negatedquery ] [musthaveattachment|hasattachment] [excludechats] [size larger|smaller ] - [label ] [important|notimportant] [star] [trash] [markread] [archive] [neverspam] [forward ]` -`gam delete filters ` -`gam show filters` -`gam info filters ` -`gam print filters [todrive]` +gam [add] filter [from ] [to ] [subject ] [haswords|query ] [nowords|negatedquery ] [musthaveattachment|hasattachment] [excludechats] [size larger|smaller ] + [label ] [important|notimportant] [star] [trash] [markread] [archive] [neverspam] [forward ] +gam delete filters +gam show filters +gam info filters +gam print filters [todrive] Added commands to process Gmail forwarding addresses. -`gam add forwardingaddress|forwardingaddresses ` -`gam delete forwardingaddress|forwardingaddresses ` -`gam show forwardingaddress|forwardingaddresses` -`gam info forwardingaddress|forwardingaddresses ` -`gam print forwardingaddress|forwardingaddresses [todrive]` +gam add forwardingaddress|forwardingaddresses +gam delete forwardingaddress|forwardingaddresses +gam show forwardingaddress|forwardingaddresses +gam info forwardingaddress|forwardingaddresses +gam print forwardingaddress|forwardingaddresses [todrive] Improved Gmail forward processing. -`gam forward ` -`gam forward keep|leaveininbox|archive|delete|trash|markread ` -`gam show forward` -`gam print forward [todrive]` +gam forward +gam forward keep|leaveininbox|archive|delete|trash|markread +gam show forward +gam print forward [todrive] Improved Gmail sendas processing. -`gam [add] sendas [replyto ] [default] [treatasalias ] [signature|sig |(file [charset ]) (replace )*]` -`gam update sendas [name ] [replyto ] [default] [treatasalias ] [signature|sig |(file [charset ]) (replace )*]` -`gam delete sendas ` -`gam show sendas [format]` -`gam info sendas [format]` -`gam print sendas [todrive]` +gam [add] sendas [replyto ] [default] [treatasalias ] [signature|sig |(file [charset ]) (replace )*] +gam update sendas [name ] [replyto ] [default] [treatasalias ] [signature|sig |(file [charset ]) (replace )*] +gam delete sendas +gam show sendas [format] +gam info sendas [format] +gam print sendas [todrive] Improved Gmail signature processing. -`gam signature|sig |(file [charset ]) (replace )* [name ] [replyto ] ` -`gam show signature|sig [format]` +gam signature|sig |(file [charset ]) (replace )* [name ] [replyto ] +gam show signature|sig [format] Use Gmail API for POP/IMAP/Vacation processing. -`gam imap|imap4 [noautoexpunge] [expungebehavior archive|deleteforever|trash] [maxfoldersize 0|1000|2000|5000|10000]` -`gam pop|pop3 [for allmail|newmail|mailfromnowon|fromnowown] [action keep|leaveininbox|archive|delete|trash|markread]` -`gam vacation ` -`gam vacation subject (message )|(file [charset ]) (replace )* [html] - [contactsonly] [domainonly] [startdate ] [enddate ]` -`gam show vacation [format]` +gam imap|imap4 [noautoexpunge] [expungebehavior archive|deleteforever|trash] [maxfoldersize 0|1000|2000|5000|10000] +gam pop|pop3 [for allmail|newmail|mailfromnowon|fromnowown] [action keep|leaveininbox|archive|delete|trash|markread] +gam vacation +gam vacation subject (message )|(file [charset ]) (replace )* [html] + [contactsonly] [domainonly] [startdate ] [enddate ] +gam show vacation [format] Added command toGet information about a specific calendar. -`gam info calendar ` +gam info calendar Added command to print calendars to CSV file, dropped all arguments from gam show calendars. -`gam print calendars [todrive]` -`gam show calendars` +gam print calendars [todrive] +gam show calendars Added command to print Gmail Profiles to CSV file, dropped all arguments from gam show gmailprofile. -`gam print gmailprofile [todrive]` -`gam show gmailprofile` +gam print gmailprofile [todrive] +gam show gmailprofile Added command to print Gplus Profiles to CSV file, dropped all arguments from gam show gplusprofile. -`gam print gplusprofile [todrive]` -`gam show gplusprofile` +gam print gplusprofile [todrive] +gam show gplusprofile Added command to print user schemas to CSV file, renamed command to display formatted user schemas to gam show schemas. -`gam print schemas [todrive]` -`gam show schemas` +gam print schemas [todrive] +gam show schemas Added command to print user access tokens to CSV file. -`gam print tokens|token|3lo|oauth [todrive]` +gam print tokens|token|3lo|oauth [todrive] Added arguments to gam info cros to allow specification of desired output fields. -`gam info cros [nolists] [listlimit ] - [basic|full|allfields] * [fields ]` +gam info cros [nolists] [listlimit ] + [basic|full|allfields] * [fields ] Added drivedir and targetfolder arguments to gam printjob fetch and gam get photo to allow specification of the destination folder for the file retrieved from Google. The default location for these commands is the current working directory, drivedir specifies the value of the environment variable GAMDRIVEDIR and targetfolder specifies a user-choosen path. -`gam printjob |any fetch +gam printjob |any fetch [olderthan|newerthan ] [query ] [status ] [orderby [ascending|descending]] [owner|user ] - [limit ] [drivedir|(targetfolder )]` -`gam get photo [drivedir|(targetfolder )]` + [limit ] [drivedir|(targetfolder )] +gam get photo [drivedir|(targetfolder )] + +Added noshow argument to gam get photo to suppress displaying of photo data +gam get photo [drivedir|(targetfolder )] [noshow] Commands that produce CSV file output have been changed to make the leftmost column(s) be the key fields. If you have scripts that process the CSV files as flat files, expecting the columns to be in a particular