| 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)'
|
| 23446 |
amit.gupta |
28 |
print ' LogisticsInfo getLogisticsInfo(string destination_pincode, i64 item_id, DeliveryType type, PickUpType pickUp, i64 stateId)'
|
| 23121 |
amit.gupta |
29 |
print ' string getEmptyAWB(i64 providerId, string logisticsTransactionId)'
|
| 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)'
|
| 13146 |
manish.sha |
42 |
print ' bool addNewAwbs(i64 providerId, bool cod, awbs, i64 awbUsedFor)'
|
| 23121 |
amit.gupta |
43 |
print ' void runLogisticsLocationInfoUpdate( logisticsLocationInfoList, bool runCompleteUpdate, i64 provider)'
|
| 7888 |
rajveer |
44 |
print ' i64 adjustDeliveryDays(i64 startDate, i64 days)'
|
| 12895 |
manish.sha |
45 |
print ' i64 getFirstDeliveryEstimateForWhLocation(string pincode, i64 whLocation)'
|
| 13146 |
manish.sha |
46 |
print ' string getNewEmptyAwb(i64 providerId, DeliveryType type, i64 orderQuantity)'
|
|
|
47 |
print ' getProviderLimitDetailsForPincode(i64 providerId, string pincode)'
|
| 19413 |
amit.gupta |
48 |
print ' getLocationInfoMap(string destPincode, price)'
|
| 19474 |
manish.sha |
49 |
print ' DeliveryEstimateAndCosting getCostingAndDeliveryEstimateForPincode(string pincode, double transactionAmount, bool isCod, double weight, i64 billingWarehouseId, bool isCompleteTxn)'
|
| 23121 |
amit.gupta |
50 |
print ' BluedartAttributes getBluedartAttributesForLogisticsTxnId(string logisticsTxnId, string name)'
|
| 23218 |
amit.gupta |
51 |
print ' bool pushCourierDetailsForEcomExpress( logisticsTransactionIds)'
|
| 412 |
ashish |
52 |
print ''
|
|
|
53 |
sys.exit(0)
|
|
|
54 |
|
|
|
55 |
pp = pprint.PrettyPrinter(indent = 2)
|
|
|
56 |
host = 'localhost'
|
|
|
57 |
port = 9090
|
|
|
58 |
uri = ''
|
|
|
59 |
framed = False
|
|
|
60 |
http = False
|
|
|
61 |
argi = 1
|
|
|
62 |
|
|
|
63 |
if sys.argv[argi] == '-h':
|
| 3431 |
rajveer |
64 |
parts = sys.argv[argi+1].split(':')
|
| 412 |
ashish |
65 |
host = parts[0]
|
|
|
66 |
port = int(parts[1])
|
|
|
67 |
argi += 2
|
|
|
68 |
|
|
|
69 |
if sys.argv[argi] == '-u':
|
|
|
70 |
url = urlparse(sys.argv[argi+1])
|
| 3431 |
rajveer |
71 |
parts = url[1].split(':')
|
| 412 |
ashish |
72 |
host = parts[0]
|
|
|
73 |
if len(parts) > 1:
|
|
|
74 |
port = int(parts[1])
|
|
|
75 |
else:
|
|
|
76 |
port = 80
|
|
|
77 |
uri = url[2]
|
| 3431 |
rajveer |
78 |
if url[4]:
|
|
|
79 |
uri += '?%s' % url[4]
|
| 412 |
ashish |
80 |
http = True
|
|
|
81 |
argi += 2
|
|
|
82 |
|
|
|
83 |
if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
|
|
|
84 |
framed = True
|
|
|
85 |
argi += 1
|
|
|
86 |
|
|
|
87 |
cmd = sys.argv[argi]
|
|
|
88 |
args = sys.argv[argi+1:]
|
|
|
89 |
|
|
|
90 |
if http:
|
|
|
91 |
transport = THttpClient.THttpClient(host, port, uri)
|
|
|
92 |
else:
|
|
|
93 |
socket = TSocket.TSocket(host, port)
|
|
|
94 |
if framed:
|
|
|
95 |
transport = TTransport.TFramedTransport(socket)
|
|
|
96 |
else:
|
|
|
97 |
transport = TTransport.TBufferedTransport(socket)
|
|
|
98 |
protocol = TBinaryProtocol.TBinaryProtocol(transport)
|
|
|
99 |
client = LogisticsService.Client(protocol)
|
|
|
100 |
transport.open()
|
|
|
101 |
|
| 3376 |
rajveer |
102 |
if cmd == 'getProvider':
|
| 669 |
chandransh |
103 |
if len(args) != 1:
|
|
|
104 |
print 'getProvider requires 1 args'
|
|
|
105 |
sys.exit(1)
|
|
|
106 |
pp.pprint(client.getProvider(eval(args[0]),))
|
|
|
107 |
|
| 675 |
chandransh |
108 |
elif cmd == 'getAllProviders':
|
|
|
109 |
if len(args) != 0:
|
|
|
110 |
print 'getAllProviders requires 0 args'
|
|
|
111 |
sys.exit(1)
|
|
|
112 |
pp.pprint(client.getAllProviders())
|
|
|
113 |
|
| 669 |
chandransh |
114 |
elif cmd == 'getLogisticsEstimation':
|
| 4630 |
mandeep.dh |
115 |
if len(args) != 3:
|
|
|
116 |
print 'getLogisticsEstimation requires 3 args'
|
| 483 |
rajveer |
117 |
sys.exit(1)
|
| 4630 |
mandeep.dh |
118 |
pp.pprint(client.getLogisticsEstimation(eval(args[0]),args[1],eval(args[2]),))
|
| 483 |
rajveer |
119 |
|
| 7256 |
rajveer |
120 |
elif cmd == 'getLogisticsEstimationForStore':
|
|
|
121 |
if len(args) != 3:
|
|
|
122 |
print 'getLogisticsEstimationForStore requires 3 args'
|
|
|
123 |
sys.exit(1)
|
|
|
124 |
pp.pprint(client.getLogisticsEstimationForStore(eval(args[0]),args[1],eval(args[2]),))
|
|
|
125 |
|
| 647 |
chandransh |
126 |
elif cmd == 'getLogisticsInfo':
|
| 23446 |
amit.gupta |
127 |
if len(args) != 5:
|
|
|
128 |
print 'getLogisticsInfo requires 5 args'
|
| 412 |
ashish |
129 |
sys.exit(1)
|
| 23446 |
amit.gupta |
130 |
pp.pprint(client.getLogisticsInfo(args[0],eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
|
| 412 |
ashish |
131 |
|
|
|
132 |
elif cmd == 'getEmptyAWB':
|
| 5247 |
rajveer |
133 |
if len(args) != 2:
|
|
|
134 |
print 'getEmptyAWB requires 2 args'
|
| 412 |
ashish |
135 |
sys.exit(1)
|
| 23121 |
amit.gupta |
136 |
pp.pprint(client.getEmptyAWB(eval(args[0]),args[1],))
|
| 412 |
ashish |
137 |
|
|
|
138 |
elif cmd == 'getShipmentInfo':
|
| 647 |
chandransh |
139 |
if len(args) != 2:
|
|
|
140 |
print 'getShipmentInfo requires 2 args'
|
| 412 |
ashish |
141 |
sys.exit(1)
|
| 647 |
chandransh |
142 |
pp.pprint(client.getShipmentInfo(args[0],eval(args[1]),))
|
| 412 |
ashish |
143 |
|
| 6643 |
rajveer |
144 |
elif cmd == 'storeShipmentInfo':
|
|
|
145 |
if len(args) != 1:
|
|
|
146 |
print 'storeShipmentInfo requires 1 args'
|
|
|
147 |
sys.exit(1)
|
|
|
148 |
pp.pprint(client.storeShipmentInfo(eval(args[0]),))
|
|
|
149 |
|
| 732 |
chandransh |
150 |
elif cmd == 'getDestinationCode':
|
|
|
151 |
if len(args) != 2:
|
|
|
152 |
print 'getDestinationCode requires 2 args'
|
|
|
153 |
sys.exit(1)
|
|
|
154 |
pp.pprint(client.getDestinationCode(eval(args[0]),args[1],))
|
|
|
155 |
|
| 1137 |
chandransh |
156 |
elif cmd == 'getFreeAwbCount':
|
| 3103 |
chandransh |
157 |
if len(args) != 2:
|
|
|
158 |
print 'getFreeAwbCount requires 2 args'
|
| 1137 |
chandransh |
159 |
sys.exit(1)
|
| 3103 |
chandransh |
160 |
pp.pprint(client.getFreeAwbCount(eval(args[0]),args[1],))
|
| 1137 |
chandransh |
161 |
|
| 1730 |
ankur.sing |
162 |
elif cmd == 'getHolidays':
|
|
|
163 |
if len(args) != 2:
|
|
|
164 |
print 'getHolidays requires 2 args'
|
|
|
165 |
sys.exit(1)
|
|
|
166 |
pp.pprint(client.getHolidays(eval(args[0]),eval(args[1]),))
|
|
|
167 |
|
| 4934 |
amit.gupta |
168 |
elif cmd == 'getEntityLogisticsEstimation':
|
|
|
169 |
if len(args) != 3:
|
|
|
170 |
print 'getEntityLogisticsEstimation requires 3 args'
|
|
|
171 |
sys.exit(1)
|
|
|
172 |
pp.pprint(client.getEntityLogisticsEstimation(eval(args[0]),args[1],eval(args[2]),))
|
|
|
173 |
|
| 5527 |
anupam.sin |
174 |
elif cmd == 'getProviderForPickupType':
|
|
|
175 |
if len(args) != 1:
|
|
|
176 |
print 'getProviderForPickupType requires 1 args'
|
|
|
177 |
sys.exit(1)
|
|
|
178 |
pp.pprint(client.getProviderForPickupType(eval(args[0]),))
|
|
|
179 |
|
| 5553 |
rajveer |
180 |
elif cmd == 'getAllPickupStores':
|
|
|
181 |
if len(args) != 0:
|
|
|
182 |
print 'getAllPickupStores requires 0 args'
|
|
|
183 |
sys.exit(1)
|
|
|
184 |
pp.pprint(client.getAllPickupStores())
|
|
|
185 |
|
|
|
186 |
elif cmd == 'getPickupStore':
|
|
|
187 |
if len(args) != 1:
|
|
|
188 |
print 'getPickupStore requires 1 args'
|
|
|
189 |
sys.exit(1)
|
|
|
190 |
pp.pprint(client.getPickupStore(eval(args[0]),))
|
|
|
191 |
|
| 5719 |
rajveer |
192 |
elif cmd == 'getPickupStoreByHotspotId':
|
|
|
193 |
if len(args) != 1:
|
|
|
194 |
print 'getPickupStoreByHotspotId requires 1 args'
|
|
|
195 |
sys.exit(1)
|
|
|
196 |
pp.pprint(client.getPickupStoreByHotspotId(args[0],))
|
|
|
197 |
|
| 6524 |
rajveer |
198 |
elif cmd == 'addPincode':
|
|
|
199 |
if len(args) != 7:
|
|
|
200 |
print 'addPincode requires 7 args'
|
|
|
201 |
sys.exit(1)
|
|
|
202 |
pp.pprint(client.addPincode(eval(args[0]),args[1],args[2],eval(args[3]),eval(args[4]),eval(args[5]),eval(args[6]),))
|
|
|
203 |
|
|
|
204 |
elif cmd == 'updatePincode':
|
|
|
205 |
if len(args) != 5:
|
|
|
206 |
print 'updatePincode requires 5 args'
|
|
|
207 |
sys.exit(1)
|
|
|
208 |
pp.pprint(client.updatePincode(eval(args[0]),args[1],eval(args[2]),eval(args[3]),eval(args[4]),))
|
|
|
209 |
|
| 7567 |
rajveer |
210 |
elif cmd == 'addNewAwbs':
|
| 13146 |
manish.sha |
211 |
if len(args) != 4:
|
|
|
212 |
print 'addNewAwbs requires 4 args'
|
| 7567 |
rajveer |
213 |
sys.exit(1)
|
| 13146 |
manish.sha |
214 |
pp.pprint(client.addNewAwbs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
|
| 7567 |
rajveer |
215 |
|
| 7787 |
manish.sha |
216 |
elif cmd == 'runLogisticsLocationInfoUpdate':
|
| 23121 |
amit.gupta |
217 |
if len(args) != 3:
|
|
|
218 |
print 'runLogisticsLocationInfoUpdate requires 3 args'
|
| 7738 |
manish.sha |
219 |
sys.exit(1)
|
| 23121 |
amit.gupta |
220 |
pp.pprint(client.runLogisticsLocationInfoUpdate(eval(args[0]),eval(args[1]),eval(args[2]),))
|
| 7738 |
manish.sha |
221 |
|
| 7888 |
rajveer |
222 |
elif cmd == 'adjustDeliveryDays':
|
|
|
223 |
if len(args) != 2:
|
|
|
224 |
print 'adjustDeliveryDays requires 2 args'
|
|
|
225 |
sys.exit(1)
|
|
|
226 |
pp.pprint(client.adjustDeliveryDays(eval(args[0]),eval(args[1]),))
|
|
|
227 |
|
| 12895 |
manish.sha |
228 |
elif cmd == 'getFirstDeliveryEstimateForWhLocation':
|
|
|
229 |
if len(args) != 2:
|
|
|
230 |
print 'getFirstDeliveryEstimateForWhLocation requires 2 args'
|
|
|
231 |
sys.exit(1)
|
|
|
232 |
pp.pprint(client.getFirstDeliveryEstimateForWhLocation(args[0],eval(args[1]),))
|
|
|
233 |
|
| 13146 |
manish.sha |
234 |
elif cmd == 'getNewEmptyAwb':
|
|
|
235 |
if len(args) != 3:
|
|
|
236 |
print 'getNewEmptyAwb requires 3 args'
|
|
|
237 |
sys.exit(1)
|
|
|
238 |
pp.pprint(client.getNewEmptyAwb(eval(args[0]),eval(args[1]),eval(args[2]),))
|
|
|
239 |
|
|
|
240 |
elif cmd == 'getProviderLimitDetailsForPincode':
|
|
|
241 |
if len(args) != 2:
|
|
|
242 |
print 'getProviderLimitDetailsForPincode requires 2 args'
|
|
|
243 |
sys.exit(1)
|
|
|
244 |
pp.pprint(client.getProviderLimitDetailsForPincode(eval(args[0]),args[1],))
|
|
|
245 |
|
| 19413 |
amit.gupta |
246 |
elif cmd == 'getLocationInfoMap':
|
|
|
247 |
if len(args) != 2:
|
|
|
248 |
print 'getLocationInfoMap requires 2 args'
|
|
|
249 |
sys.exit(1)
|
|
|
250 |
pp.pprint(client.getLocationInfoMap(args[0],eval(args[1]),))
|
|
|
251 |
|
| 19474 |
manish.sha |
252 |
elif cmd == 'getCostingAndDeliveryEstimateForPincode':
|
|
|
253 |
if len(args) != 6:
|
|
|
254 |
print 'getCostingAndDeliveryEstimateForPincode requires 6 args'
|
|
|
255 |
sys.exit(1)
|
|
|
256 |
pp.pprint(client.getCostingAndDeliveryEstimateForPincode(args[0],eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),eval(args[5]),))
|
|
|
257 |
|
| 23121 |
amit.gupta |
258 |
elif cmd == 'getBluedartAttributesForLogisticsTxnId':
|
|
|
259 |
if len(args) != 2:
|
|
|
260 |
print 'getBluedartAttributesForLogisticsTxnId requires 2 args'
|
|
|
261 |
sys.exit(1)
|
|
|
262 |
pp.pprint(client.getBluedartAttributesForLogisticsTxnId(args[0],args[1],))
|
|
|
263 |
|
| 23218 |
amit.gupta |
264 |
elif cmd == 'pushCourierDetailsForEcomExpress':
|
|
|
265 |
if len(args) != 1:
|
|
|
266 |
print 'pushCourierDetailsForEcomExpress requires 1 args'
|
|
|
267 |
sys.exit(1)
|
|
|
268 |
pp.pprint(client.pushCourierDetailsForEcomExpress(eval(args[0]),))
|
|
|
269 |
|
| 3431 |
rajveer |
270 |
else:
|
|
|
271 |
print 'Unrecognized method %s' % cmd
|
|
|
272 |
sys.exit(1)
|
|
|
273 |
|
| 412 |
ashish |
274 |
transport.close()
|