Skip to content
Permalink
a5256e7a02
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
15 lines (12 sloc) 666 Bytes
from riotRequests import requestChampionData
# Riot API documentation was used.
# https://developer.riotgames.com/api-methods/ and https://developer.riotgames.com/static-data.html
def champNameByID(champID):
"""Returns champion name by taking champion id as input. Champion Data function is used"""
championData = requestChampionData()
allChampions = championData['data']
# Loops trough all champions until the given id matches with champion id so it can return champion name.
for champion in allChampions:
if champID == allChampions[champion]['key']:
champName = allChampions[champion]['name']
return champName