mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-28 18:01:36 +00:00
Update draft/import/insert/sendemail (#959)
* Update draft/import/insert/sendemail If possible, use same option names as already exist in my Gam for same commands. Include charset with file. * Code cleanup
This commit is contained in:
15
src/gam.py
15
src/gam.py
@@ -1074,7 +1074,7 @@ def callGAPI(service, function,
|
||||
continue
|
||||
systemErrorExit(4, str(e))
|
||||
except (httplib2.ServerNotFoundError, RuntimeError) as e:
|
||||
if (n != retries):
|
||||
if n != retries:
|
||||
service._http.connections = {}
|
||||
waitOnFailure(n, retries, str(e))
|
||||
continue
|
||||
@@ -5351,12 +5351,13 @@ def sendOrDropEmail(users, method='send'):
|
||||
i = 4
|
||||
while i < len(sys.argv):
|
||||
myarg = sys.argv[i].lower().replace('_', '')
|
||||
if myarg == 'body':
|
||||
if myarg == 'message':
|
||||
body = sys.argv[i+1]
|
||||
i += 2
|
||||
elif myarg == 'bodyfile':
|
||||
body = readFile(sys.argv[i+1])
|
||||
i += 2
|
||||
elif myarg == 'file':
|
||||
filename = sys.argv[i+1]
|
||||
i, encoding = getCharSet(i+2)
|
||||
body = readFile(filename, encoding=encoding)
|
||||
elif myarg == 'subject':
|
||||
subject = sys.argv[i+1]
|
||||
i += 2
|
||||
@@ -10951,8 +10952,8 @@ def send_email(subject, body, recipient=None, sender=None, method='send', labels
|
||||
api_body = {'message': api_body}
|
||||
elif method in ['insert', 'import']:
|
||||
kwargs['internalDateSource'] = 'dateHeader'
|
||||
if method == 'import':
|
||||
method = 'import_'
|
||||
if method == 'import':
|
||||
method = 'import_'
|
||||
callGAPI(resource, method, userId=userId, body=api_body, **kwargs)
|
||||
|
||||
def addFieldToFieldsList(fieldName, fieldsChoiceMap, fieldsList):
|
||||
|
||||
Reference in New Issue
Block a user