Rev 12895 | Rev 19474 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#!/usr/bin/env python## Autogenerated by Thrift Compiler (0.7.0)## DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING#import sysimport pprintfrom urlparse import urlparsefrom thrift.transport import TTransportfrom thrift.transport import TSocketfrom thrift.transport import THttpClientfrom thrift.protocol import TBinaryProtocolimport LogisticsServicefrom ttypes import *if len(sys.argv) <= 1 or sys.argv[1] == '--help':print ''print 'Usage: ' + sys.argv[0] + ' [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]'print ''print 'Functions:'print ' Provider getProvider(i64 providerId)'print ' getAllProviders()'print ' LogisticsInfo getLogisticsEstimation(i64 itemId, string destination_pin, DeliveryType type)'print ' LogisticsInfo getLogisticsEstimationForStore(i64 itemId, string destination_pin, DeliveryType type)'print ' LogisticsInfo getLogisticsInfo(string destination_pincode, i64 item_id, DeliveryType type, PickUpType pickUp)'print ' string getEmptyAWB(i64 providerId, DeliveryType type)'print ' getShipmentInfo(string awbNumber, i64 providerId)'print ' void storeShipmentInfo(AwbUpdate update)'print ' string getDestinationCode(i64 providerId, string pinCode)'print ' i64 getFreeAwbCount(i64 providerId, string type)'print ' getHolidays(i64 fromDate, i64 toDate)'print ' getEntityLogisticsEstimation(i64 catalogItemId, string destination_pin, DeliveryType type)'print ' i64 getProviderForPickupType(i64 pickUp)'print ' getAllPickupStores()'print ' PickupStore getPickupStore(i64 storeId)'print ' PickupStore getPickupStoreByHotspotId(string hotspotId)'print ' void addPincode(i64 providerId, string pincode, string destCode, bool exp, bool cod, i32 stationType, bool otgAvailable)'print ' void updatePincode(i64 providerId, string pincode, bool exp, bool cod, bool otgAvailable)'print ' bool addNewAwbs(i64 providerId, bool cod, awbs, i64 awbUsedFor)'print ' void runLogisticsLocationInfoUpdate( logisticsLocationInfoList, bool runCompleteUpdate)'print ' i64 adjustDeliveryDays(i64 startDate, i64 days)'print ' i64 getFirstDeliveryEstimateForWhLocation(string pincode, i64 whLocation)'print ' string getNewEmptyAwb(i64 providerId, DeliveryType type, i64 orderQuantity)'print ' getProviderLimitDetailsForPincode(i64 providerId, string pincode)'print ''sys.exit(0)pp = pprint.PrettyPrinter(indent = 2)host = 'localhost'port = 9090uri = ''framed = Falsehttp = Falseargi = 1if sys.argv[argi] == '-h':parts = sys.argv[argi+1].split(':')host = parts[0]port = int(parts[1])argi += 2if sys.argv[argi] == '-u':url = urlparse(sys.argv[argi+1])parts = url[1].split(':')host = parts[0]if len(parts) > 1:port = int(parts[1])else:port = 80uri = url[2]if url[4]:uri += '?%s' % url[4]http = Trueargi += 2if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':framed = Trueargi += 1cmd = sys.argv[argi]args = sys.argv[argi+1:]if http:transport = THttpClient.THttpClient(host, port, uri)else:socket = TSocket.TSocket(host, port)if framed:transport = TTransport.TFramedTransport(socket)else:transport = TTransport.TBufferedTransport(socket)protocol = TBinaryProtocol.TBinaryProtocol(transport)client = LogisticsService.Client(protocol)transport.open()if cmd == 'getProvider':if len(args) != 1:print 'getProvider requires 1 args'sys.exit(1)pp.pprint(client.getProvider(eval(args[0]),))elif cmd == 'getAllProviders':if len(args) != 0:print 'getAllProviders requires 0 args'sys.exit(1)pp.pprint(client.getAllProviders())elif cmd == 'getLogisticsEstimation':if len(args) != 3:print 'getLogisticsEstimation requires 3 args'sys.exit(1)pp.pprint(client.getLogisticsEstimation(eval(args[0]),args[1],eval(args[2]),))elif cmd == 'getLogisticsEstimationForStore':if len(args) != 3:print 'getLogisticsEstimationForStore requires 3 args'sys.exit(1)pp.pprint(client.getLogisticsEstimationForStore(eval(args[0]),args[1],eval(args[2]),))elif cmd == 'getLogisticsInfo':if len(args) != 4:print 'getLogisticsInfo requires 4 args'sys.exit(1)pp.pprint(client.getLogisticsInfo(args[0],eval(args[1]),eval(args[2]),eval(args[3]),))elif cmd == 'getEmptyAWB':if len(args) != 2:print 'getEmptyAWB requires 2 args'sys.exit(1)pp.pprint(client.getEmptyAWB(eval(args[0]),eval(args[1]),))elif cmd == 'getShipmentInfo':if len(args) != 2:print 'getShipmentInfo requires 2 args'sys.exit(1)pp.pprint(client.getShipmentInfo(args[0],eval(args[1]),))elif cmd == 'storeShipmentInfo':if len(args) != 1:print 'storeShipmentInfo requires 1 args'sys.exit(1)pp.pprint(client.storeShipmentInfo(eval(args[0]),))elif cmd == 'getDestinationCode':if len(args) != 2:print 'getDestinationCode requires 2 args'sys.exit(1)pp.pprint(client.getDestinationCode(eval(args[0]),args[1],))elif cmd == 'getFreeAwbCount':if len(args) != 2:print 'getFreeAwbCount requires 2 args'sys.exit(1)pp.pprint(client.getFreeAwbCount(eval(args[0]),args[1],))elif cmd == 'getHolidays':if len(args) != 2:print 'getHolidays requires 2 args'sys.exit(1)pp.pprint(client.getHolidays(eval(args[0]),eval(args[1]),))elif cmd == 'getEntityLogisticsEstimation':if len(args) != 3:print 'getEntityLogisticsEstimation requires 3 args'sys.exit(1)pp.pprint(client.getEntityLogisticsEstimation(eval(args[0]),args[1],eval(args[2]),))elif cmd == 'getProviderForPickupType':if len(args) != 1:print 'getProviderForPickupType requires 1 args'sys.exit(1)pp.pprint(client.getProviderForPickupType(eval(args[0]),))elif cmd == 'getAllPickupStores':if len(args) != 0:print 'getAllPickupStores requires 0 args'sys.exit(1)pp.pprint(client.getAllPickupStores())elif cmd == 'getPickupStore':if len(args) != 1:print 'getPickupStore requires 1 args'sys.exit(1)pp.pprint(client.getPickupStore(eval(args[0]),))elif cmd == 'getPickupStoreByHotspotId':if len(args) != 1:print 'getPickupStoreByHotspotId requires 1 args'sys.exit(1)pp.pprint(client.getPickupStoreByHotspotId(args[0],))elif cmd == 'addPincode':if len(args) != 7:print 'addPincode requires 7 args'sys.exit(1)pp.pprint(client.addPincode(eval(args[0]),args[1],args[2],eval(args[3]),eval(args[4]),eval(args[5]),eval(args[6]),))elif cmd == 'updatePincode':if len(args) != 5:print 'updatePincode requires 5 args'sys.exit(1)pp.pprint(client.updatePincode(eval(args[0]),args[1],eval(args[2]),eval(args[3]),eval(args[4]),))elif cmd == 'addNewAwbs':if len(args) != 4:print 'addNewAwbs requires 4 args'sys.exit(1)pp.pprint(client.addNewAwbs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))elif cmd == 'runLogisticsLocationInfoUpdate':if len(args) != 2:print 'runLogisticsLocationInfoUpdate requires 2 args'sys.exit(1)pp.pprint(client.runLogisticsLocationInfoUpdate(eval(args[0]),eval(args[1]),))elif cmd == 'adjustDeliveryDays':if len(args) != 2:print 'adjustDeliveryDays requires 2 args'sys.exit(1)pp.pprint(client.adjustDeliveryDays(eval(args[0]),eval(args[1]),))elif cmd == 'getFirstDeliveryEstimateForWhLocation':if len(args) != 2:print 'getFirstDeliveryEstimateForWhLocation requires 2 args'sys.exit(1)pp.pprint(client.getFirstDeliveryEstimateForWhLocation(args[0],eval(args[1]),))elif cmd == 'getNewEmptyAwb':if len(args) != 3:print 'getNewEmptyAwb requires 3 args'sys.exit(1)pp.pprint(client.getNewEmptyAwb(eval(args[0]),eval(args[1]),eval(args[2]),))elif cmd == 'getProviderLimitDetailsForPincode':if len(args) != 2:print 'getProviderLimitDetailsForPincode requires 2 args'sys.exit(1)pp.pprint(client.getProviderLimitDetailsForPincode(eval(args[0]),args[1],))else:print 'Unrecognized method %s' % cmdsys.exit(1)transport.close()