Subversion Repositories SmartDukaan

Rev

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