def parser(): parser = argparse.ArgumentParser() parser.add_argument("product", nargs=1, help="product") args = parser.parse_args() if args.product is None: print "lib.py usage: lib.py product" else: print allegro_api(args.product[0])
def main(): """function that claims it does the job """ item = parse_args()["item_name"] try: url, price = lib.allegro_api(item) print "".join(["Link do przedmiotu: ", url, " Cena: ", str(price)]) except lib.NoItemException: sys.exit("Wrong item name specified, can't get results")