async def add_player_rank(player: Player, session: aiohttp.ClientSession = None): """ :description: Calls stalk player op gg using the summoner name of the given Player and adds a Rank obj to the Player. :param player: A Player obj with a summoner name. :type player: Player :param session: When a session already exits, it should be reused as much as possible for better performance. :type session: aiohttp.ClientSession :return: None :rtype: None """ if session is None: async with aiohttp.ClientSession() as session: return await add_player_rank(player, session) player.rank = Rank( rank_string=await stalk_player_op_gg(player.summoner_name, session)) return
async def add_player_rank(player: Player, api_token: str, session=None): """ :description: Calls stalk player riot using the summoner name of the given Player and adds a Rank obj to the Player. :param player: A Player obj with a summoner name. :type player: Player :param api_token: Valid Riot api token. :type api_token: str :param session: When a session already exits, it should be reused as much as possible for better performance. :type session: aiohttp.ClientSession or RateLimiter :return: None :rtype: None """ if session is None: async with aiohttp.ClientSession() as session: session = RateLimiter(session) return await add_player_rank(player, api_token, session) player.rank = Rank(rank_string=await stalk_player_riot_api( player.summoner_name, api_token, session)) return