Subversion Repositories SmartDukaan

Rev

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