Subversion Repositories SmartDukaan

Rev

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