Exemplo n.º 1
0
def riot_request(region, args):
    # set region
    baseriotapi.set_region(region)

    # extract arguments
    request = args.get("request")
    key = args.get("key")
    match_id = args.get("match_id")
    summoner_id = args.get("summoner_id")
    summoner_ids = args.get("summoner_ids")

    # make request
    if request == 1:
        riot_response = baseriotapi.get_summoners_by_name(format_key(key))
    elif request == 2:
        riot_response = baseriotapi.get_match_list(summoner_id, 0, 0, 0, 0, 0, QUEUE, SEASON)
    elif request == 3:
        riot_response = baseriotapi.get_match(match_id)
    elif request == 4:
        riot_response = baseriotapi.get_leagues_by_summoner(summoner_ids)
    elif request == 5:
        riot_response = baseriotapi.get_ranked_stats(summoner_id, SEASON)
    elif request == 6:
        riot_response = baseriotapi.get_summoner_runes(summoner_id)
    else:
        riot_response = None

    # return response
    return riot_response
Exemplo n.º 2
0
def GetBuildStatsforChamp(sumnames,cname,numgames=50,jungle=False):

	# Get Summoner Objects and summoner ids
	if len([sumnames])>1:
		summoners = cass.get_summoners_by_name(sumnames)
		sumids = list(map(lambda x: x.id,summoners))
	else:
		summoners = cass.get_summoner_by_name(sumnames)
		sumids = [summoners.id]

	champ = cass.get_champion_by_name(cname)
	matchlist = []
	itemlist = []

	for s in sumids:

		# Get Match History for specific champion for Solo Ranked this season. We can update to expand to other queues or past seasons
		matches = base.get_match_list(s,num_matches=numgames,champion_ids = champ.id,ranked_queues='RANKED_SOLO_5x5',seasons='PRESEASON2016').matches
		matchlist = matchlist + matches

	# Put in check that summoner for participant id matches summoner id
	for m in matchlist:

		# For each match, find participant object matching the champion and get item set
		match = cass.get_match(m.matchId)
		c = list(map(lambda x: x.champion.id,match.participants))
		player = match.participants[c.index(champ.id)]
		its = list(map(lambda x: x.id,filter(None,player.stats.items)))
		itemlist = itemlist + its

	
	# Format Item set and calculate percentages
	itcounts = pd.DataFrame(list(Counter(itemlist).items()),columns=['id','perc'])
	itcounts = pd.merge(itcounts,Loading.items[Loading.items['id'].isin(itemlist)],on=['id'])
	itcounts['perc'] = itcounts['perc']/itcounts['perc'].sum()

	print('numgames=' + str(len(matchlist)))

	return itcounts.sort(columns=['perc'])
Exemplo n.º 3
0
def test_match_list():
    int_test_handler.test_result(baseriotapi.get_match_list(int_test_handler.summoner_id))
Exemplo n.º 4
0
def test_match_list():
    int_test_handler.test_result(
        baseriotapi.get_match_list(int_test_handler.summoner_id))