Subversion Repositories SmartDukaan

Rev

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