Subversion Repositories SmartDukaan

Rev

Rev 644 | Rev 669 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 644 Rev 647
Line 19... Line 19...
19
if len(sys.argv) <= 1 or sys.argv[1] == '--help':
19
if len(sys.argv) <= 1 or sys.argv[1] == '--help':
20
  print ''
20
  print ''
21
  print 'Usage: ' + sys.argv[0] + ' [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]'
21
  print 'Usage: ' + sys.argv[0] + ' [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]'
22
  print ''
22
  print ''
23
  print 'Functions:'
23
  print 'Functions:'
24
  print '  LogisticsInfo getLogisticsInfo(string destination_pincode, string item_id)'
-
 
25
  print '  LogisticsInfo getLogisticsEstimation(i64 itemId, string destination_pin)'
24
  print '  LogisticsInfo getLogisticsEstimation(i64 itemId, string destination_pin)'
-
 
25
  print '  LogisticsInfo getLogisticsInfo(string destination_pincode, string item_id)'
26
  print '  string getEmptyAWB(i64 provider_id)'
26
  print '  string getEmptyAWB(i64 providerId)'
27
  print '   getShipmentInfo(string awb)'
27
  print '   getShipmentInfo(string awb, i64 providerId)'
28
  print ''
28
  print ''
29
  sys.exit(0)
29
  sys.exit(0)
30
 
30
 
31
pp = pprint.PrettyPrinter(indent = 2)
31
pp = pprint.PrettyPrinter(indent = 2)
32
host = 'localhost'
32
host = 'localhost'
Line 71... Line 71...
71
    transport = TTransport.TBufferedTransport(socket)
71
    transport = TTransport.TBufferedTransport(socket)
72
protocol = TBinaryProtocol.TBinaryProtocol(transport)
72
protocol = TBinaryProtocol.TBinaryProtocol(transport)
73
client = LogisticsService.Client(protocol)
73
client = LogisticsService.Client(protocol)
74
transport.open()
74
transport.open()
75
 
75
 
76
if cmd == 'getLogisticsInfo':
76
if cmd == 'getLogisticsEstimation':
77
  if len(args) != 2:
77
  if len(args) != 2:
78
    print 'getLogisticsInfo requires 2 args'
78
    print 'getLogisticsEstimation requires 2 args'
79
    sys.exit(1)
79
    sys.exit(1)
80
  pp.pprint(client.getLogisticsInfo(args[0],args[1],))
80
  pp.pprint(client.getLogisticsEstimation(eval(args[0]),args[1],))
81
 
81
 
82
elif cmd == 'getLogisticsEstimation':
82
elif cmd == 'getLogisticsInfo':
83
  if len(args) != 2:
83
  if len(args) != 2:
84
    print 'getLogisticsEstimation requires 2 args'
84
    print 'getLogisticsInfo requires 2 args'
85
    sys.exit(1)
85
    sys.exit(1)
86
  pp.pprint(client.getLogisticsEstimation(eval(args[0]),args[1],))
86
  pp.pprint(client.getLogisticsInfo(args[0],args[1],))
87
 
87
 
88
elif cmd == 'getEmptyAWB':
88
elif cmd == 'getEmptyAWB':
89
  if len(args) != 1:
89
  if len(args) != 1:
90
    print 'getEmptyAWB requires 1 args'
90
    print 'getEmptyAWB requires 1 args'
91
    sys.exit(1)
91
    sys.exit(1)
92
  pp.pprint(client.getEmptyAWB(eval(args[0]),))
92
  pp.pprint(client.getEmptyAWB(eval(args[0]),))
93
 
93
 
94
elif cmd == 'getShipmentInfo':
94
elif cmd == 'getShipmentInfo':
95
  if len(args) != 1:
95
  if len(args) != 2:
96
    print 'getShipmentInfo requires 1 args'
96
    print 'getShipmentInfo requires 2 args'
97
    sys.exit(1)
97
    sys.exit(1)
98
  pp.pprint(client.getShipmentInfo(args[0],))
98
  pp.pprint(client.getShipmentInfo(args[0],eval(args[1]),))
99
 
99
 
100
transport.close()
100
transport.close()