Browse Source

Merge branch 'master' into viya4_v1

master
Gerry Nelson 5 years ago
committed by GitHub
parent
commit
19057cb564
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      sharedfunctions.py
  2. 9
      snapshotreports.py

3
sharedfunctions.py

@ -33,6 +33,7 @@
# 20dec2018 Fixed standard csv output # 20dec2018 Fixed standard csv output
# 14JAN2019 Added getpath # 14JAN2019 Added getpath
# 20SEP2019 Added getidsanduris # 20SEP2019 Added getidsanduris
# 09dec2020 Added get_valid_filename function to deal with invalid characters for Linux filesystem
# #
# Copyright © 2018, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. # Copyright © 2018, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
# #
@ -58,6 +59,8 @@ import pprint
import os import os
import collections import collections
import inspect import inspect
import re
pp = pprint.PrettyPrinter(indent=4) pp = pprint.PrettyPrinter(indent=4)

9
snapshotreports.py

@ -21,6 +21,7 @@
# 16may2020 add folder path to report name # 16may2020 add folder path to report name
# 16may2020 allow to subset reports exported by the path of the report folder # 16may2020 allow to subset reports exported by the path of the report folder
# 10aug2020 add option to auto delete transport file after download completes # 10aug2020 add option to auto delete transport file after download completes
# 09dec2020 add get_valid_filename function to deal with invalid characters for Linux filesystem
# #
# Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. # Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
# #
@ -38,10 +39,12 @@
# #
# Import Python modules # Import Python modules
import re
import argparse, sys, subprocess, uuid, time, os, glob import argparse, sys, subprocess, uuid, time, os, glob
from datetime import datetime as dt, timedelta as td from datetime import datetime as dt, timedelta as td
from sharedfunctions import getfolderid, callrestapi, getpath, getapplicationproperties, get_valid_filename from sharedfunctions import getfolderid, callrestapi, getpath, getapplicationproperties, get_valid_filename
# get python version # get python version
version=int(str(sys.version_info[0])) version=int(str(sys.version_info[0]))
@ -151,7 +154,8 @@ if areyousure.upper() =='Y':
path_to_report=path_to_report.replace("/","_") path_to_report=path_to_report.replace("/","_")
package_name=str(uuid.uuid1()) package_name=str(uuid.uuid1())
json_name=get_valid_filename(path_to_report+resultdata['items'][i]["name"].replace(" ","")+'_'+str(i))
json_name=get_valid_filename(path_to_report+resultdata['items'][i]["name"].replace(" ","")+'_'+str(i))
command=clicommand+' transfer export -u /reports/reports/'+id+' --name "'+package_name+'"' command=clicommand+' transfer export -u /reports/reports/'+id+' --name "'+package_name+'"'
print(command) print(command)
@ -174,8 +178,7 @@ if areyousure.upper() =='Y':
remTransferObject.wait() remTransferObject.wait()
print("NOTE: "+str(reports_exported)+" report(s) exported to json files in "+path) print("NOTE: "+str(total_items)+" total reports found, "+str(reports_exported)+" reports exported to json files in "+path)
else: else:
print("NOTE: Operation cancelled") print("NOTE: Operation cancelled")

Loading…
Cancel
Save