def do_createShipment(args): boxIDArray = [] li = args.boxIDArray.split(",") for x in li: boxIDArray.append(int(x)) origin = args.origin destination = args.destination url = _get_url(args) keyfile = _get_keyfile(args) auth_user, auth_password = _get_auth_info(args) client = TransferClient(base_url=url, keyfile=keyfile) if args.wait and args.wait > 0: response = client.createShipment(boxIDArray, origin, destination, wait=args.wait, auth_user=auth_user, auth_password=auth_password) else: response = client.createShipment(boxIDArray, origin, destination, auth_user=auth_user, auth_password=auth_password) print("Response : {}".format(response))
def do_updateBox(args): medicineName = args.medicineName medicineID = args.medicineID units = args.units boxID = args.boxID url = _get_url(args) keyfile = _get_keyfile(args) auth_user, auth_password = _get_auth_info(args) client = TransferClient(base_url=url, keyfile=keyfile) if args.wait and args.wait > 0: response = client.updateBox(medicineName, medicineID, units, boxID, wait=args.wait, auth_user=auth_user, auth_password=auth_password) else: response = client.updateBox(medicineName, medicineID, units, boxID, auth_user=auth_user, auth_password=auth_password) print("Response : {}".format(response))
def do_updateShipmentStatus(args): shipmentID = args.shipmentID shipmentStatus = args.shipmentStatus url = _get_url(args) keyfile = _get_keyfile(args) auth_user , auth_password = _get_auth_info(args) client = TransferClient(base_url = url, keyfile= keyfile) if args.wait and args.wait > 0: response = client.updateShipmentStatus( shipmentID, shipmentStatus, wait = args.wait, auth_user = auth_user, auth_password = auth_password ) else: response = client.updateShipmentStatus( shipmentID, shipmentStatus, auth_user = auth_user, auth_password = auth_password ) print("Response : {}".format(response))
def do_show(args): ID = args.ID url = _get_url(args) auth_user, auth_password = _get_auth_info(args) client = TransferClient(base_url=url, keyfile=None) data = client.show(ID, auth_user=auth_user, auth_password=auth_password) if data is not None: print(data) else: raise TransferException("Asset not found: {}".format(shipmentID))
def do_list(args): url = _get_url(args) auth_user, auth_password = _get_auth_info(args) client = TransferClient(base_url=url, keyfile=None) asset_list = [ asset.split(',') for assets in client.list(auth_user=auth_user, auth_password=auth_password) for asset in assets.decode().split('|') ] if asset_list is not None: print(asset_list) else: raise TransferException("Could not retireve List")
def do_show(args): ID = args.ID url = _get_url(args) auth_user, auth_password = _get_auth_info(args) client = TransferClient(base_url=url, keyfile=None) data = client.show(ID, auth_user=auth_user, auth_password=auth_password) if data is not None: print('-'*50) for x in data: print(x) print('x'*10) print('-'*50) else: raise TransferException("Assets not found!")