def do_bid(args): '''Subcommand to bid . Calls client class to do the bidding''' privkeyfile = _get_private_keyfile(KEY_NAME) client = CookieJarClient(base_url=DEFAULT_URL, key_file=privkeyfile) s_name = args.supplier_name response = client.bake(args.amount, s_name) print("Bid Response: {}".format(response))
def do_count(): '''Subcommand to find winner of . Calls client class to do the counting.''' privkeyfile = _get_private_keyfile(KEY_NAME) client = CookieJarClient(base_url=DEFAULT_URL, key_file=privkeyfile) data = client.count() if data is not None: print("\nThe winner of the auction is {} .\n".format(data.decode())) else: raise Exception("auction data not found")
def do_eat(args): '''Subcommand to eat cookies. Calls client class to do the eating.''' privkeyfile = _get_private_keyfile(KEY_NAME) client = CookieJarClient(base_url=DEFAULT_URL, key_file=privkeyfile) response = client.eat(args.amount) print("Eat Response: {}".format(response))
def do_clear(): '''Subcommand to empty cookie jar. Calls client class to do the clearing.''' privkeyfile = _get_private_keyfile(KEY_NAME) client = CookieJarClient(base_url=DEFAULT_URL, key_file=privkeyfile) response = client.clear() print("Clear Response: {}".format(response))