How to use the cassiopeia.dto.requests function in cassiopeia

To help you get started, we’ve selected a few cassiopeia examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github meraki-analytics / kernel / merakikernel / integrations / cassiopeia / matchbindings.py View on Github external
def get_match(id_, include_timeline=True, tournament_code=""):
    region = cassiopeia.dto.requests.region
    return cassiopeia.type.dto.match.MatchDetail(merakikernel.riotapi.matchapi.match(region, str(id_), {"includeTimeline": str(include_timeline)}))
github meraki-analytics / cassiopeia / cassiopeia / baseriotapi.py View on Github external
def set_api_key(key):
    """
    Set your API key

    Args:
        key (str): the key to use
    """
    cassiopeia.dto.requests.api_key = key
    if not cassiopeia.dto.requests.rate_limiter:
        cassiopeia.dto.requests.rate_limiter = cassiopeia.type.api.rates.MultiRateLimiter((10, 10), (500, 600))
github meraki-analytics / kernel / merakikernel / integrations / cassiopeia / featuredgamesbindings.py View on Github external
def get_featured_games():
    region = cassiopeia.dto.requests.region
    return cassiopeia.type.dto.featuredgames.FeaturedGames(merakikernel.riotapi.featuredgamesapi.featured_games(region))
github meraki-analytics / cassiopeia / cassiopeia / dto / statsapi.py View on Github external
def get_ranked_stats(summoner_id, season=None):
    """
    https://developer.riotgames.com/api/methods#!/1018/3452

    Args:
        summoner_id (int): the summoner to get ranked stats for
        season (str): the season to get ranked stats for ("SEASON2015", "SEASON2014", "SEASON3") (default None)

    Returns:
        RankedStats: the ranked stats for the summoner and season specified
    """
    request = "{version}/stats/by-summoner/{id_}/ranked".format(version=cassiopeia.dto.requests.api_versions["stats"], id_=summoner_id)

    params = {}
    if season:
        params["season"] = season

    return cassiopeia.type.dto.stats.RankedStats(cassiopeia.dto.requests.get(request, params))
github meraki-analytics / cassiopeia / cassiopeia / dto / tournamentapi.py View on Github external
def update_tournament_code(tournament_code, parameters):
    """
    https://developer.riotgames.com/api/methods#!/1057/3647

    Args:
        tournament_code (str): the tournament code to update
        parameters (TournamentCodeUpdateParameters): the new parameters for the tournament code
    """
    request = "https://{server}.api.pvp.net/tournament/public/{version}/code/{code}".format(server=cassiopeia.dto.requests.region, version=cassiopeia.dto.requests.api_versions["tournament"], code=tournament_code)
    cassiopeia.dto.requests.put(request, parameters, include_base=False, tournament=True)
github meraki-analytics / kernel / merakikernel / integrations / cassiopeia / leaguebindings.py View on Github external
def get_master(queue_type):
    region = cassiopeia.dto.requests.region
    return cassiopeia.type.dto.league.League(merakikernel.riotapi.leagueapi.master(region, {"type": queue_type}))
github meraki-analytics / kernel / merakikernel / integrations / cassiopeia / statsbindings.py View on Github external
def get_ranked_stats(summoner_id, season=None):
    region = cassiopeia.dto.requests.region

    params = {}
    if season:
        params["season"] = season

    return cassiopeia.type.dto.stats.RankedStats(merakikernel.riotapi.statsapi.ranked_stats(region, str(summoner_id), params))
github meraki-analytics / cassiopeia / cassiopeia / dto / matchlistapi.py View on Github external
https://developer.riotgames.com/api/methods#!/1013/3439

    Args:
        summoner_id (int): the ID of the summoner to get the match history for
        num_matches (int): the maximum number of matches to retrieve. 0 will get as many as possible. (default 0)
        begin_index (int): the game index to start from (default 0)
        begin_time (int): the begin time to use for fetching games specified as epoch milliseconds (default 0)
        end_time (int): the end time to use for fetching games specified as epoch milliseconds (default 0)
        champion_ids (int | list): the champion ID(s) to limit the results to (default None)
        ranked_queues (str | list): the ranked queue(s) to limit the results to ("RANKED_SOLO_5x5", "RANKED_TEAM_3x3", "RANKED_TEAM_5x5") (default None)
        seasons (str | list): the season(s) to limit the results to ("PRESEASON3", "SEASON3", "PRESEASON2014", "SEASON2014", "PRESEASON2015", "SEASON2015", "PRESEASON2016", "SEASON2016") (default None)

    Returns:
        MatchList: the summoner's match history
    """
    request = "{version}/matchlist/by-summoner/{summoner_id}".format(version=cassiopeia.dto.requests.api_versions["matchlist"], summoner_id=summoner_id)

    params = {}
    if num_matches:
        params["endIndex"] = begin_index + num_matches
    if begin_index or num_matches:
        params["beginIndex"] = begin_index
    if begin_time:
        params["beginTime"] = begin_time
    if end_time:
        params["endTime"] = end_time
    if champion_ids:
        params["championIds"] = ",".join(champion_ids) if isinstance(champion_ids, list) else str(champion_ids)
    if ranked_queues:
        params["rankedQueues"] = ",".join(ranked_queues) if isinstance(ranked_queues, list) else str(ranked_queues)
    if seasons:
        params["seasons"] = ",".join(seasons) if isinstance(seasons, list) else str(seasons)
github meraki-analytics / cassiopeia / cassiopeia / dto / statusapi.py View on Github external
def get_shard():
    """
    https://developer.riotgames.com/api/methods#!/908/3142

    Returns:
        ShardStatus: the status of the current region's shard
    """
    request = "http://status.leagueoflegends.com/shards/{region}".format(region=cassiopeia.dto.requests.region)
    return cassiopeia.type.dto.status.ShardStatus(cassiopeia.dto.requests.get(request, static=True, include_base=False))
github meraki-analytics / kernel / merakikernel / integrations / cassiopeia / staticdatabindings.py View on Github external
def get_champion(id_):
    region = cassiopeia.dto.requests.region

    params = {"champData": "all"}
    if cassiopeia.dto.staticdataapi._locale:
        params["locale"] = cassiopeia.dto.staticdataapi._locale

    return cassiopeia.type.dto.staticdata.Champion(merakikernel.riotapi.staticdataapi.champion_id(region, id_, params))