7 return ''.join([str(string) for string in lst])
10 def debug(desc, *args):
12 print(desc, join_strings(args))
19 def error_and_exit(error_code, error_desc):
21 print("status={0}. {1}".format(error_code, '' if not error_desc else error_desc))
23 print("status={0}".format(error_code))
27 def print_name_and_return_code(name, code, with_line=True):
28 if _strings_correct(name, code):
30 print("----------------------------------------")
31 print("{0:30} | {1:6}".format(name, code))
33 print("----------------------------------------")
35 print("name of the item or return code from request is none -> error occurred!!")
38 def _strings_correct(*strings):
39 results = [(string is not None and string != "") for string in strings]
40 return all(results) is True
42 # def parse_cmd_line_params(argv):
43 # print('Number of arguments:', len(sys.argv), 'arguments.')
47 # be_host = 'localhost'
49 # admin_user = 'jh0003'
53 # opts, args = getopt.getopt(argv, "i:p:u:h:s:", ["ip=", "port=", "user=", "scheme="])
54 # except getopt.GetoptError:
56 # error_and_exit(2, 'Invalid input')
58 # for opt, arg in opts:
63 # elif opt in ("-i", "--ip"):
65 # elif opt in ("-p", "--port"):
67 # elif opt in ("-u", "--user"):
69 # elif opt in ("-s", "--scheme"):
72 # print('scheme =', scheme, ', be host =', be_host, ', be port =', be_port, ', user =', admin_user)
77 # return scheme, be_host, be_port, admin_user
81 # print(sys.argv[0], '[optional -s <scheme> | --scheme=<scheme>, default http ] '
82 # '[-i <be host> | --ip=<be host>] [-p <be port> | '
83 # '--port=<be port> ] [-u <user userId> | --user=<user userId> ] ')