Subversion Repositories SmartDukaan

Rev

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