| 5944 |
mandeep.dh |
1 |
#!/usr/bin/env python
|
|
|
2 |
#
|
|
|
3 |
# Autogenerated by Thrift Compiler (0.7.0)
|
|
|
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 InventoryService
|
|
|
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:'
|
|
|
24 |
print ' i64 addWarehouse(Warehouse warehouse)'
|
|
|
25 |
print ' i64 addVendor(Vendor vendor)'
|
|
|
26 |
print ' void updateInventoryHistory(i64 warehouse_id, string timestamp, availability)'
|
|
|
27 |
print ' void updateInventory(i64 warehouse_id, string timestamp, availability)'
|
|
|
28 |
print ' void addInventory(i64 itemId, i64 warehouseId, i64 quantity)'
|
|
|
29 |
print ' void retireWarehouse(i64 warehouse_id)'
|
|
|
30 |
print ' ItemInventory getItemInventoryByItemId(i64 item_id)'
|
|
|
31 |
print ' i64 getItemAvailibilityAtWarehouse(i64 warehouse_id, i64 item_id)'
|
| 5978 |
rajveer |
32 |
print ' getItemAvailabilityAtLocation(i64 itemId, i64 sourceId)'
|
| 5944 |
mandeep.dh |
33 |
print ' getAllWarehouses(bool isActive)'
|
|
|
34 |
print ' Warehouse getWarehouse(i64 warehouse_id)'
|
|
|
35 |
print ' getAllItemsForWarehouse(i64 warehouse_id)'
|
| 5966 |
rajveer |
36 |
print ' bool isOrderBillable(i64 itemId, i64 warehouseId, i64 sourceId, i64 orderId)'
|
|
|
37 |
print ' bool reserveItemInWarehouse(i64 itemId, i64 warehouseId, i64 sourceId, i64 orderId, i64 createdTimestamp, i64 promisedShippingTimestamp, double quantity)'
|
|
|
38 |
print ' bool reduceReservationCount(i64 itemId, i64 warehouseId, i64 sourceId, i64 orderId, double quantity)'
|
| 5944 |
mandeep.dh |
39 |
print ' VendorItemPricing getItemPricing(i64 itemId, i64 vendorId)'
|
|
|
40 |
print ' getAllItemPricing(i64 itemId)'
|
|
|
41 |
print ' void addVendorItemPricing(VendorItemPricing vendorItemPricing)'
|
|
|
42 |
print ' Vendor getVendor(i64 vendorId)'
|
|
|
43 |
print ' getAllVendors()'
|
|
|
44 |
print ' void addVendorItemMapping(string key, VendorItemMapping vendorItemMapping)'
|
|
|
45 |
print ' getVendorItemMappings(i64 itemId)'
|
|
|
46 |
print ' getPendingOrdersInventory(i64 vendorid)'
|
|
|
47 |
print ' getWarehouses(WarehouseType warehouseType, InventoryType inventoryType, i64 vendorId, i64 billingWarehouseId, i64 shippingWarehouseId)'
|
|
|
48 |
print ' void resetAvailability(string itemKey, i64 vendorId, i64 quantity, i64 warehouseId)'
|
|
|
49 |
print ' void resetAvailabilityForWarehouse(i64 warehouseId)'
|
|
|
50 |
print ' getItemKeysToBeProcessed(i64 warehouseId)'
|
|
|
51 |
print ' void markMissedInventoryUpdatesAsProcessed(string itemKey, i64 warehouseId)'
|
|
|
52 |
print ' getIgnoredItemKeys()'
|
|
|
53 |
print ' void addBadInventory(i64 itemId, i64 warehouseId, i64 quantity)'
|
|
|
54 |
print ' getShippingLocations()'
|
|
|
55 |
print ' getAllVendorItemMappings()'
|
|
|
56 |
print ' getInventorySnapshot(i64 warehouseId)'
|
|
|
57 |
print ' void clearItemAvailabilityCache()'
|
|
|
58 |
print ' void updateVendorString(i64 warehouseId, string vendorString)'
|
| 6096 |
amit.gupta |
59 |
print ' void clearItemAvailabilityCacheForItem(i64 item_id)'
|
| 5944 |
mandeep.dh |
60 |
print ''
|
|
|
61 |
sys.exit(0)
|
|
|
62 |
|
|
|
63 |
pp = pprint.PrettyPrinter(indent = 2)
|
|
|
64 |
host = 'localhost'
|
|
|
65 |
port = 9090
|
|
|
66 |
uri = ''
|
|
|
67 |
framed = False
|
|
|
68 |
http = False
|
|
|
69 |
argi = 1
|
|
|
70 |
|
|
|
71 |
if sys.argv[argi] == '-h':
|
|
|
72 |
parts = sys.argv[argi+1].split(':')
|
|
|
73 |
host = parts[0]
|
|
|
74 |
port = int(parts[1])
|
|
|
75 |
argi += 2
|
|
|
76 |
|
|
|
77 |
if sys.argv[argi] == '-u':
|
|
|
78 |
url = urlparse(sys.argv[argi+1])
|
|
|
79 |
parts = url[1].split(':')
|
|
|
80 |
host = parts[0]
|
|
|
81 |
if len(parts) > 1:
|
|
|
82 |
port = int(parts[1])
|
|
|
83 |
else:
|
|
|
84 |
port = 80
|
|
|
85 |
uri = url[2]
|
|
|
86 |
if url[4]:
|
|
|
87 |
uri += '?%s' % url[4]
|
|
|
88 |
http = True
|
|
|
89 |
argi += 2
|
|
|
90 |
|
|
|
91 |
if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
|
|
|
92 |
framed = True
|
|
|
93 |
argi += 1
|
|
|
94 |
|
|
|
95 |
cmd = sys.argv[argi]
|
|
|
96 |
args = sys.argv[argi+1:]
|
|
|
97 |
|
|
|
98 |
if http:
|
|
|
99 |
transport = THttpClient.THttpClient(host, port, uri)
|
|
|
100 |
else:
|
|
|
101 |
socket = TSocket.TSocket(host, port)
|
|
|
102 |
if framed:
|
|
|
103 |
transport = TTransport.TFramedTransport(socket)
|
|
|
104 |
else:
|
|
|
105 |
transport = TTransport.TBufferedTransport(socket)
|
|
|
106 |
protocol = TBinaryProtocol.TBinaryProtocol(transport)
|
|
|
107 |
client = InventoryService.Client(protocol)
|
|
|
108 |
transport.open()
|
|
|
109 |
|
|
|
110 |
if cmd == 'addWarehouse':
|
|
|
111 |
if len(args) != 1:
|
|
|
112 |
print 'addWarehouse requires 1 args'
|
|
|
113 |
sys.exit(1)
|
|
|
114 |
pp.pprint(client.addWarehouse(eval(args[0]),))
|
|
|
115 |
|
|
|
116 |
elif cmd == 'addVendor':
|
|
|
117 |
if len(args) != 1:
|
|
|
118 |
print 'addVendor requires 1 args'
|
|
|
119 |
sys.exit(1)
|
|
|
120 |
pp.pprint(client.addVendor(eval(args[0]),))
|
|
|
121 |
|
|
|
122 |
elif cmd == 'updateInventoryHistory':
|
|
|
123 |
if len(args) != 3:
|
|
|
124 |
print 'updateInventoryHistory requires 3 args'
|
|
|
125 |
sys.exit(1)
|
|
|
126 |
pp.pprint(client.updateInventoryHistory(eval(args[0]),args[1],eval(args[2]),))
|
|
|
127 |
|
|
|
128 |
elif cmd == 'updateInventory':
|
|
|
129 |
if len(args) != 3:
|
|
|
130 |
print 'updateInventory requires 3 args'
|
|
|
131 |
sys.exit(1)
|
|
|
132 |
pp.pprint(client.updateInventory(eval(args[0]),args[1],eval(args[2]),))
|
|
|
133 |
|
|
|
134 |
elif cmd == 'addInventory':
|
|
|
135 |
if len(args) != 3:
|
|
|
136 |
print 'addInventory requires 3 args'
|
|
|
137 |
sys.exit(1)
|
|
|
138 |
pp.pprint(client.addInventory(eval(args[0]),eval(args[1]),eval(args[2]),))
|
|
|
139 |
|
|
|
140 |
elif cmd == 'retireWarehouse':
|
|
|
141 |
if len(args) != 1:
|
|
|
142 |
print 'retireWarehouse requires 1 args'
|
|
|
143 |
sys.exit(1)
|
|
|
144 |
pp.pprint(client.retireWarehouse(eval(args[0]),))
|
|
|
145 |
|
|
|
146 |
elif cmd == 'getItemInventoryByItemId':
|
|
|
147 |
if len(args) != 1:
|
|
|
148 |
print 'getItemInventoryByItemId requires 1 args'
|
|
|
149 |
sys.exit(1)
|
|
|
150 |
pp.pprint(client.getItemInventoryByItemId(eval(args[0]),))
|
|
|
151 |
|
|
|
152 |
elif cmd == 'getItemAvailibilityAtWarehouse':
|
|
|
153 |
if len(args) != 2:
|
|
|
154 |
print 'getItemAvailibilityAtWarehouse requires 2 args'
|
|
|
155 |
sys.exit(1)
|
|
|
156 |
pp.pprint(client.getItemAvailibilityAtWarehouse(eval(args[0]),eval(args[1]),))
|
|
|
157 |
|
|
|
158 |
elif cmd == 'getItemAvailabilityAtLocation':
|
| 5978 |
rajveer |
159 |
if len(args) != 2:
|
|
|
160 |
print 'getItemAvailabilityAtLocation requires 2 args'
|
| 5944 |
mandeep.dh |
161 |
sys.exit(1)
|
| 5978 |
rajveer |
162 |
pp.pprint(client.getItemAvailabilityAtLocation(eval(args[0]),eval(args[1]),))
|
| 5944 |
mandeep.dh |
163 |
|
|
|
164 |
elif cmd == 'getAllWarehouses':
|
|
|
165 |
if len(args) != 1:
|
|
|
166 |
print 'getAllWarehouses requires 1 args'
|
|
|
167 |
sys.exit(1)
|
|
|
168 |
pp.pprint(client.getAllWarehouses(eval(args[0]),))
|
|
|
169 |
|
|
|
170 |
elif cmd == 'getWarehouse':
|
|
|
171 |
if len(args) != 1:
|
|
|
172 |
print 'getWarehouse requires 1 args'
|
|
|
173 |
sys.exit(1)
|
|
|
174 |
pp.pprint(client.getWarehouse(eval(args[0]),))
|
|
|
175 |
|
|
|
176 |
elif cmd == 'getAllItemsForWarehouse':
|
|
|
177 |
if len(args) != 1:
|
|
|
178 |
print 'getAllItemsForWarehouse requires 1 args'
|
|
|
179 |
sys.exit(1)
|
|
|
180 |
pp.pprint(client.getAllItemsForWarehouse(eval(args[0]),))
|
|
|
181 |
|
| 5966 |
rajveer |
182 |
elif cmd == 'isOrderBillable':
|
|
|
183 |
if len(args) != 4:
|
|
|
184 |
print 'isOrderBillable requires 4 args'
|
|
|
185 |
sys.exit(1)
|
|
|
186 |
pp.pprint(client.isOrderBillable(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
|
|
|
187 |
|
| 5944 |
mandeep.dh |
188 |
elif cmd == 'reserveItemInWarehouse':
|
| 5966 |
rajveer |
189 |
if len(args) != 7:
|
|
|
190 |
print 'reserveItemInWarehouse requires 7 args'
|
| 5944 |
mandeep.dh |
191 |
sys.exit(1)
|
| 5966 |
rajveer |
192 |
pp.pprint(client.reserveItemInWarehouse(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),eval(args[5]),eval(args[6]),))
|
| 5944 |
mandeep.dh |
193 |
|
|
|
194 |
elif cmd == 'reduceReservationCount':
|
| 5966 |
rajveer |
195 |
if len(args) != 5:
|
|
|
196 |
print 'reduceReservationCount requires 5 args'
|
| 5944 |
mandeep.dh |
197 |
sys.exit(1)
|
| 5966 |
rajveer |
198 |
pp.pprint(client.reduceReservationCount(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
|
| 5944 |
mandeep.dh |
199 |
|
|
|
200 |
elif cmd == 'getItemPricing':
|
|
|
201 |
if len(args) != 2:
|
|
|
202 |
print 'getItemPricing requires 2 args'
|
|
|
203 |
sys.exit(1)
|
|
|
204 |
pp.pprint(client.getItemPricing(eval(args[0]),eval(args[1]),))
|
|
|
205 |
|
|
|
206 |
elif cmd == 'getAllItemPricing':
|
|
|
207 |
if len(args) != 1:
|
|
|
208 |
print 'getAllItemPricing requires 1 args'
|
|
|
209 |
sys.exit(1)
|
|
|
210 |
pp.pprint(client.getAllItemPricing(eval(args[0]),))
|
|
|
211 |
|
|
|
212 |
elif cmd == 'addVendorItemPricing':
|
|
|
213 |
if len(args) != 1:
|
|
|
214 |
print 'addVendorItemPricing requires 1 args'
|
|
|
215 |
sys.exit(1)
|
|
|
216 |
pp.pprint(client.addVendorItemPricing(eval(args[0]),))
|
|
|
217 |
|
|
|
218 |
elif cmd == 'getVendor':
|
|
|
219 |
if len(args) != 1:
|
|
|
220 |
print 'getVendor requires 1 args'
|
|
|
221 |
sys.exit(1)
|
|
|
222 |
pp.pprint(client.getVendor(eval(args[0]),))
|
|
|
223 |
|
|
|
224 |
elif cmd == 'getAllVendors':
|
|
|
225 |
if len(args) != 0:
|
|
|
226 |
print 'getAllVendors requires 0 args'
|
|
|
227 |
sys.exit(1)
|
|
|
228 |
pp.pprint(client.getAllVendors())
|
|
|
229 |
|
|
|
230 |
elif cmd == 'addVendorItemMapping':
|
|
|
231 |
if len(args) != 2:
|
|
|
232 |
print 'addVendorItemMapping requires 2 args'
|
|
|
233 |
sys.exit(1)
|
|
|
234 |
pp.pprint(client.addVendorItemMapping(args[0],eval(args[1]),))
|
|
|
235 |
|
|
|
236 |
elif cmd == 'getVendorItemMappings':
|
|
|
237 |
if len(args) != 1:
|
|
|
238 |
print 'getVendorItemMappings requires 1 args'
|
|
|
239 |
sys.exit(1)
|
|
|
240 |
pp.pprint(client.getVendorItemMappings(eval(args[0]),))
|
|
|
241 |
|
|
|
242 |
elif cmd == 'getPendingOrdersInventory':
|
|
|
243 |
if len(args) != 1:
|
|
|
244 |
print 'getPendingOrdersInventory requires 1 args'
|
|
|
245 |
sys.exit(1)
|
|
|
246 |
pp.pprint(client.getPendingOrdersInventory(eval(args[0]),))
|
|
|
247 |
|
|
|
248 |
elif cmd == 'getWarehouses':
|
|
|
249 |
if len(args) != 5:
|
|
|
250 |
print 'getWarehouses requires 5 args'
|
|
|
251 |
sys.exit(1)
|
|
|
252 |
pp.pprint(client.getWarehouses(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
|
|
|
253 |
|
|
|
254 |
elif cmd == 'resetAvailability':
|
|
|
255 |
if len(args) != 4:
|
|
|
256 |
print 'resetAvailability requires 4 args'
|
|
|
257 |
sys.exit(1)
|
|
|
258 |
pp.pprint(client.resetAvailability(args[0],eval(args[1]),eval(args[2]),eval(args[3]),))
|
|
|
259 |
|
|
|
260 |
elif cmd == 'resetAvailabilityForWarehouse':
|
|
|
261 |
if len(args) != 1:
|
|
|
262 |
print 'resetAvailabilityForWarehouse requires 1 args'
|
|
|
263 |
sys.exit(1)
|
|
|
264 |
pp.pprint(client.resetAvailabilityForWarehouse(eval(args[0]),))
|
|
|
265 |
|
|
|
266 |
elif cmd == 'getItemKeysToBeProcessed':
|
|
|
267 |
if len(args) != 1:
|
|
|
268 |
print 'getItemKeysToBeProcessed requires 1 args'
|
|
|
269 |
sys.exit(1)
|
|
|
270 |
pp.pprint(client.getItemKeysToBeProcessed(eval(args[0]),))
|
|
|
271 |
|
|
|
272 |
elif cmd == 'markMissedInventoryUpdatesAsProcessed':
|
|
|
273 |
if len(args) != 2:
|
|
|
274 |
print 'markMissedInventoryUpdatesAsProcessed requires 2 args'
|
|
|
275 |
sys.exit(1)
|
|
|
276 |
pp.pprint(client.markMissedInventoryUpdatesAsProcessed(args[0],eval(args[1]),))
|
|
|
277 |
|
|
|
278 |
elif cmd == 'getIgnoredItemKeys':
|
|
|
279 |
if len(args) != 0:
|
|
|
280 |
print 'getIgnoredItemKeys requires 0 args'
|
|
|
281 |
sys.exit(1)
|
|
|
282 |
pp.pprint(client.getIgnoredItemKeys())
|
|
|
283 |
|
|
|
284 |
elif cmd == 'addBadInventory':
|
|
|
285 |
if len(args) != 3:
|
|
|
286 |
print 'addBadInventory requires 3 args'
|
|
|
287 |
sys.exit(1)
|
|
|
288 |
pp.pprint(client.addBadInventory(eval(args[0]),eval(args[1]),eval(args[2]),))
|
|
|
289 |
|
|
|
290 |
elif cmd == 'getShippingLocations':
|
|
|
291 |
if len(args) != 0:
|
|
|
292 |
print 'getShippingLocations requires 0 args'
|
|
|
293 |
sys.exit(1)
|
|
|
294 |
pp.pprint(client.getShippingLocations())
|
|
|
295 |
|
|
|
296 |
elif cmd == 'getAllVendorItemMappings':
|
|
|
297 |
if len(args) != 0:
|
|
|
298 |
print 'getAllVendorItemMappings requires 0 args'
|
|
|
299 |
sys.exit(1)
|
|
|
300 |
pp.pprint(client.getAllVendorItemMappings())
|
|
|
301 |
|
|
|
302 |
elif cmd == 'getInventorySnapshot':
|
|
|
303 |
if len(args) != 1:
|
|
|
304 |
print 'getInventorySnapshot requires 1 args'
|
|
|
305 |
sys.exit(1)
|
|
|
306 |
pp.pprint(client.getInventorySnapshot(eval(args[0]),))
|
|
|
307 |
|
|
|
308 |
elif cmd == 'clearItemAvailabilityCache':
|
|
|
309 |
if len(args) != 0:
|
|
|
310 |
print 'clearItemAvailabilityCache requires 0 args'
|
|
|
311 |
sys.exit(1)
|
|
|
312 |
pp.pprint(client.clearItemAvailabilityCache())
|
|
|
313 |
|
|
|
314 |
elif cmd == 'updateVendorString':
|
|
|
315 |
if len(args) != 2:
|
|
|
316 |
print 'updateVendorString requires 2 args'
|
|
|
317 |
sys.exit(1)
|
|
|
318 |
pp.pprint(client.updateVendorString(eval(args[0]),args[1],))
|
|
|
319 |
|
| 6096 |
amit.gupta |
320 |
elif cmd == 'clearItemAvailabilityCacheForItem':
|
|
|
321 |
if len(args) != 1:
|
|
|
322 |
print 'clearItemAvailabilityCacheForItem requires 1 args'
|
|
|
323 |
sys.exit(1)
|
|
|
324 |
pp.pprint(client.clearItemAvailabilityCacheForItem(eval(args[0]),))
|
|
|
325 |
|
| 5944 |
mandeep.dh |
326 |
else:
|
|
|
327 |
print 'Unrecognized method %s' % cmd
|
|
|
328 |
sys.exit(1)
|
|
|
329 |
|
|
|
330 |
transport.close()
|