def get_match(match_id: str): """ """ rsp = get_request(f'https://{ep.EP_NA}{ep.EP_MATCH_MATCHES}{match_id}', _API_PARAM) return Match(rsp.json())
def get_matchlist(account_id: str, champion: list = None, queue: list = None, season: list = None, end_time: int = None, begin_time: int = None, end_index: int = None, begin_index: int = 0): """ Gets the matchlist for an account If only the account is specified then all matches will be returned If extra parameters are given then matches will be filtered according. Check https://developer.riotgames.com/apis#match-v4/GET_getMatchlist for more details TODO: mess with Set[int] parameters (champion, queue, season) Args account_id: champion: queue: season: end_time: begin_time: end_index: begin_index: Return list of matches """ parameters = _API_PARAM.copy() if champion is not None: parameters['champion'] = champion if queue is not None: parameters['queue'] = queue if season is not None: parameters['season'] = season if end_time is not None: parameters['endTime'] = end_time if begin_time is not None: parameters['beginTime'] = begin_time if end_index is not None: parameters['endIndex'] = end_index if begin_index is not None: parameters['beginIndex'] = begin_index # print(parameters) match_lists = [] while not match_lists or len(match_lists[-1]) >= 100: rsp = get_request( f'https://{ep.EP_NA}{ep.EP_MATCHLIST_BY_ACCOUNT}{account_id}', parameters) match_lists.append(rsp.json()['matches']) parameters['beginIndex'] = rsp.json()['endIndex'] match_list = list(chain(*match_lists)) return match_list
def get_summoner_league(summoner_id: str) -> League: """ Gets the league information for a summoner. Information included is rank, leagueId, hotStreak, queueType, among other information. Check Riot API for more details. Args summoner_id: should be the encrypted summoner_id for an account Returns League class object that contains the necessary data """ rsp = get_request( f'https://{ep.EP_NA}{ep.EP_LEAGUE_BY_SUMMONER}{summoner_id}', params=_API_PARAM) return League(rsp.json())
def get_summoner_by_id(summoner_id: str): assert isinstance(summoner_id, str) rsp = get_request( f'https://{ep.EP_NA}{ep.EP_SUMMONER_SUMMONER_ID}{summoner_id}', params=_API_PARAM) return Summoner(rsp.json())
def get_summoner_by_name(name: str): assert isinstance(name, str) rsp = get_request(f'https://{ep.EP_NA}{ep.EP_SUMMONER_NAME}{name}', params=_API_PARAM) return Summoner(rsp.json())