Subversion Repositories SmartDukaan

Rev

Rev 7738 | Rev 7888 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
412 ashish 1
#!/usr/bin/env python
2
#
3431 rajveer 3
# Autogenerated by Thrift Compiler (0.7.0)
412 ashish 4
#
5
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
6
#
7
 
8
import sys
9
import pprint
10
from urlparse import urlparse
11
from thrift.transport import TTransport
12
from thrift.transport import TSocket
13
from thrift.transport import THttpClient
14
from thrift.protocol import TBinaryProtocol
15
 
16
import LogisticsService
17
from ttypes import *
18
 
19
if len(sys.argv) <= 1 or sys.argv[1] == '--help':
20
  print ''
21
  print 'Usage: ' + sys.argv[0] + ' [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]'
22
  print ''
23
  print 'Functions:'
669 chandransh 24
  print '  Provider getProvider(i64 providerId)'
675 chandransh 25
  print '   getAllProviders()'
4630 mandeep.dh 26
  print '  LogisticsInfo getLogisticsEstimation(i64 itemId, string destination_pin, DeliveryType type)'
7256 rajveer 27
  print '  LogisticsInfo getLogisticsEstimationForStore(i64 itemId, string destination_pin, DeliveryType type)'
5767 rajveer 28
  print '  LogisticsInfo getLogisticsInfo(string destination_pincode, i64 item_id, DeliveryType type, PickUpType pickUp)'
5247 rajveer 29
  print '  string getEmptyAWB(i64 providerId, DeliveryType type)'
6643 rajveer 30
  print '   getShipmentInfo(string awbNumber, i64 providerId)'
31
  print '  void storeShipmentInfo(AwbUpdate update)'
732 chandransh 32
  print '  string getDestinationCode(i64 providerId, string pinCode)'
3103 chandransh 33
  print '  i64 getFreeAwbCount(i64 providerId, string type)'
1730 ankur.sing 34
  print '   getHolidays(i64 fromDate, i64 toDate)'
4934 amit.gupta 35
  print '   getEntityLogisticsEstimation(i64 catalogItemId, string destination_pin, DeliveryType type)'
5527 anupam.sin 36
  print '  i64 getProviderForPickupType(i64 pickUp)'
5553 rajveer 37
  print '   getAllPickupStores()'
38
  print '  PickupStore getPickupStore(i64 storeId)'
5719 rajveer 39
  print '  PickupStore getPickupStoreByHotspotId(string hotspotId)'
6524 rajveer 40
  print '  void addPincode(i64 providerId, string pincode, string destCode, bool exp, bool cod, i32 stationType, bool otgAvailable)'
41
  print '  void updatePincode(i64 providerId, string pincode, bool exp, bool cod, bool otgAvailable)'
7567 rajveer 42
  print '  bool addNewAwbs(i64 providerId, bool cod,  awbs)'
7787 manish.sha 43
  print '  void runLogisticsLocationInfoUpdate( logisticsLocationInfoList, bool runCompleteUpdate)'
412 ashish 44
  print ''
45
  sys.exit(0)
46
 
47
pp = pprint.PrettyPrinter(indent = 2)
48
host = 'localhost'
49
port = 9090
50
uri = ''
51
framed = False
52
http = False
53
argi = 1
54
 
55
if sys.argv[argi] == '-h':
3431 rajveer 56
  parts = sys.argv[argi+1].split(':')
412 ashish 57
  host = parts[0]
58
  port = int(parts[1])
59
  argi += 2
60
 
61
if sys.argv[argi] == '-u':
62
  url = urlparse(sys.argv[argi+1])
3431 rajveer 63
  parts = url[1].split(':')
412 ashish 64
  host = parts[0]
65
  if len(parts) > 1:
66
    port = int(parts[1])
67
  else:
68
    port = 80
69
  uri = url[2]
3431 rajveer 70
  if url[4]:
71
    uri += '?%s' % url[4]
412 ashish 72
  http = True
73
  argi += 2
74
 
75
if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
76
  framed = True
77
  argi += 1
78
 
79
cmd = sys.argv[argi]
80
args = sys.argv[argi+1:]
81
 
82
if http:
83
  transport = THttpClient.THttpClient(host, port, uri)
84
else:
85
  socket = TSocket.TSocket(host, port)
86
  if framed:
87
    transport = TTransport.TFramedTransport(socket)
88
  else:
89
    transport = TTransport.TBufferedTransport(socket)
90
protocol = TBinaryProtocol.TBinaryProtocol(transport)
91
client = LogisticsService.Client(protocol)
92
transport.open()
93
 
3376 rajveer 94
if cmd == 'getProvider':
669 chandransh 95
  if len(args) != 1:
96
    print 'getProvider requires 1 args'
97
    sys.exit(1)
98
  pp.pprint(client.getProvider(eval(args[0]),))
99
 
675 chandransh 100
elif cmd == 'getAllProviders':
101
  if len(args) != 0:
102
    print 'getAllProviders requires 0 args'
103
    sys.exit(1)
104
  pp.pprint(client.getAllProviders())
105
 
669 chandransh 106
elif cmd == 'getLogisticsEstimation':
4630 mandeep.dh 107
  if len(args) != 3:
108
    print 'getLogisticsEstimation requires 3 args'
483 rajveer 109
    sys.exit(1)
4630 mandeep.dh 110
  pp.pprint(client.getLogisticsEstimation(eval(args[0]),args[1],eval(args[2]),))
483 rajveer 111
 
7256 rajveer 112
elif cmd == 'getLogisticsEstimationForStore':
113
  if len(args) != 3:
114
    print 'getLogisticsEstimationForStore requires 3 args'
115
    sys.exit(1)
116
  pp.pprint(client.getLogisticsEstimationForStore(eval(args[0]),args[1],eval(args[2]),))
117
 
647 chandransh 118
elif cmd == 'getLogisticsInfo':
5767 rajveer 119
  if len(args) != 4:
120
    print 'getLogisticsInfo requires 4 args'
412 ashish 121
    sys.exit(1)
5767 rajveer 122
  pp.pprint(client.getLogisticsInfo(args[0],eval(args[1]),eval(args[2]),eval(args[3]),))
412 ashish 123
 
124
elif cmd == 'getEmptyAWB':
5247 rajveer 125
  if len(args) != 2:
126
    print 'getEmptyAWB requires 2 args'
412 ashish 127
    sys.exit(1)
5247 rajveer 128
  pp.pprint(client.getEmptyAWB(eval(args[0]),eval(args[1]),))
412 ashish 129
 
130
elif cmd == 'getShipmentInfo':
647 chandransh 131
  if len(args) != 2:
132
    print 'getShipmentInfo requires 2 args'
412 ashish 133
    sys.exit(1)
647 chandransh 134
  pp.pprint(client.getShipmentInfo(args[0],eval(args[1]),))
412 ashish 135
 
6643 rajveer 136
elif cmd == 'storeShipmentInfo':
137
  if len(args) != 1:
138
    print 'storeShipmentInfo requires 1 args'
139
    sys.exit(1)
140
  pp.pprint(client.storeShipmentInfo(eval(args[0]),))
141
 
732 chandransh 142
elif cmd == 'getDestinationCode':
143
  if len(args) != 2:
144
    print 'getDestinationCode requires 2 args'
145
    sys.exit(1)
146
  pp.pprint(client.getDestinationCode(eval(args[0]),args[1],))
147
 
1137 chandransh 148
elif cmd == 'getFreeAwbCount':
3103 chandransh 149
  if len(args) != 2:
150
    print 'getFreeAwbCount requires 2 args'
1137 chandransh 151
    sys.exit(1)
3103 chandransh 152
  pp.pprint(client.getFreeAwbCount(eval(args[0]),args[1],))
1137 chandransh 153
 
1730 ankur.sing 154
elif cmd == 'getHolidays':
155
  if len(args) != 2:
156
    print 'getHolidays requires 2 args'
157
    sys.exit(1)
158
  pp.pprint(client.getHolidays(eval(args[0]),eval(args[1]),))
159
 
4934 amit.gupta 160
elif cmd == 'getEntityLogisticsEstimation':
161
  if len(args) != 3:
162
    print 'getEntityLogisticsEstimation requires 3 args'
163
    sys.exit(1)
164
  pp.pprint(client.getEntityLogisticsEstimation(eval(args[0]),args[1],eval(args[2]),))
165
 
5527 anupam.sin 166
elif cmd == 'getProviderForPickupType':
167
  if len(args) != 1:
168
    print 'getProviderForPickupType requires 1 args'
169
    sys.exit(1)
170
  pp.pprint(client.getProviderForPickupType(eval(args[0]),))
171
 
5553 rajveer 172
elif cmd == 'getAllPickupStores':
173
  if len(args) != 0:
174
    print 'getAllPickupStores requires 0 args'
175
    sys.exit(1)
176
  pp.pprint(client.getAllPickupStores())
177
 
178
elif cmd == 'getPickupStore':
179
  if len(args) != 1:
180
    print 'getPickupStore requires 1 args'
181
    sys.exit(1)
182
  pp.pprint(client.getPickupStore(eval(args[0]),))
183
 
5719 rajveer 184
elif cmd == 'getPickupStoreByHotspotId':
185
  if len(args) != 1:
186
    print 'getPickupStoreByHotspotId requires 1 args'
187
    sys.exit(1)
188
  pp.pprint(client.getPickupStoreByHotspotId(args[0],))
189
 
6524 rajveer 190
elif cmd == 'addPincode':
191
  if len(args) != 7:
192
    print 'addPincode requires 7 args'
193
    sys.exit(1)
194
  pp.pprint(client.addPincode(eval(args[0]),args[1],args[2],eval(args[3]),eval(args[4]),eval(args[5]),eval(args[6]),))
195
 
196
elif cmd == 'updatePincode':
197
  if len(args) != 5:
198
    print 'updatePincode requires 5 args'
199
    sys.exit(1)
200
  pp.pprint(client.updatePincode(eval(args[0]),args[1],eval(args[2]),eval(args[3]),eval(args[4]),))
201
 
7567 rajveer 202
elif cmd == 'addNewAwbs':
203
  if len(args) != 3:
204
    print 'addNewAwbs requires 3 args'
205
    sys.exit(1)
206
  pp.pprint(client.addNewAwbs(eval(args[0]),eval(args[1]),eval(args[2]),))
207
 
7787 manish.sha 208
elif cmd == 'runLogisticsLocationInfoUpdate':
7738 manish.sha 209
  if len(args) != 2:
7787 manish.sha 210
    print 'runLogisticsLocationInfoUpdate requires 2 args'
7738 manish.sha 211
    sys.exit(1)
7787 manish.sha 212
  pp.pprint(client.runLogisticsLocationInfoUpdate(eval(args[0]),eval(args[1]),))
7738 manish.sha 213
 
3431 rajveer 214
else:
215
  print 'Unrecognized method %s' % cmd
216
  sys.exit(1)
217
 
412 ashish 218
transport.close()