def delete(self):

        args = self.reqparse.parse_args()
        players_list = parse_player(args["data"])
        player_status = delete_from_balance(players_list)
        response = process_output(player_status)

        return response
    def post(self):

        args = self.reqparse.parse_args()
        players_list = parse_player(args["data"])
        player_status = add_to_balance(players_list)
        response = process_output(player_status)

        return response
def process_data(response_url, players_text):

    players_list = parse_player(players_text)
    player_status = process_players(players_list)
    positive_result, player_names = process_output(player_status)
    player_names = ", ".join(player_names)

    if positive_result:
        post_slack_data(response_url, "Players added", player_names)
    else:
        post_slack_data(response_url, "Following players already exist",
                        player_names)
    def post(self):

        args = self.reqparse.parse_args()
        players_list = parse_player(args["data"])

        if "All" in players_list and len(players_list) == 1:
            player_status = deactivate_all()
            response = process_all_output(player_status)

        else:
            player_status = deactivate_players(players_list)
            response = process_output(player_status, players_list)

        return response
    def delete(self):
        args = self.reqparse.parse_args()

        try:
            players_data = ast.literal_eval(args["data"])
            if isinstance(players_data, list):
                players_list = [x.strip().title() for x in players_data]
            logger.warning(
                f"Received str repr of a list of player data {args['data']}")
        except:
            logger.debug(f"Processing datatype: {type(args['data'])}")
            players_list = parse_player(args["data"])

        player_status = delete_player(players_list)
        response = process_output(player_status)

        return response
def process_data(response_url, players_text):

    players_list = parse_player(players_text)

    if "All" in players_list and len(players_list) == 1:
        player_status = delete_all_from_balance()
        post_slack_data(response_url, "All Players Removed from balance list",
                        "-")
        return

    player_status = process_players(players_list)
    positive_result, player_names = process_output(player_status)
    player_names = ", ".join(player_names)

    if positive_result:
        post_slack_data(response_url, "Players removed from balance",
                        player_names)
    else:
        post_slack_data(response_url,
                        "Following players don't exist in balance list",
                        player_names)