Subversion Repositories SmartDukaan

Rev

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