7 def validate_address(line, address):
8 parameter = {'address': address}
9 data = httprequest.post('validate-address', parameter)
11 print(line + 'This line transaction address is not valid')
15 def validate_amount(line, amount):
19 print(line + 'This line transaction amount is not int.')
24 global _input_path, _account_id, _password
26 opts, args = getopt.getopt(argv[1:], 'i:a:p:', ['input=', 'account=', 'password='])
28 raise getopt.GetoptError('lose command option parameter')
29 except getopt.GetoptError as err:
30 print('Input error:' + str(err) +
31 '\n' + 'Example usage:' +
32 '\n' + '\t./main.py -i input.txt -a 0ETRPAV900A02 -p 123456')
35 if opt in ('-a', '--account'):
37 if opt in ('-i', '--input'):
39 if opt in ('-p', '--password'):
41 return _input_path, _account_id, _password
44 def validate_input(argv):
45 input_path, account_id, password = get_input(argv)
47 file_path = os.path.abspath('.') + os.path.sep + input_path
48 if not os.path.exists(file_path):
50 file_path = input_path
52 with open(file_path, 'r', encoding='utf-8') as file:
54 splits = line.strip().split(',')
55 validate_address(line, splits[0])
56 validate_amount(line, splits[1])
57 return file_path, account_id, password