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
35 lines (26 sloc) 1.45 KB
import requests
region = ""
summonerName = ""
APIKey = "RGAPI-a577ec56-00c3-4012-8216-18e3b1d9f553"
def requestSummonerData(region, summonerName, APIKey):
URL = "https://" + region + ".api.riotgames.com/lol/summoner/v3/summoners/by-name/" + summonerName + "?api_key=" + APIKey
response = requests.get(URL)
return response.json()
def requestRankedData(region, summonerID, APIKey):
URL = "https://" + region + ".api.riotgames.com/lol/league/v3/positions/by-summoner/" + summonerID + "?api_key=" + APIKey
response = requests.get(URL)
return response.json()
def lolranked(region, summonerName):
summonerData = requestSummonerData(region, summonerName, APIKey)
summonerID = str(summonerData['id'])
rankedData = requestRankedData(region, summonerID, APIKey)
lolflexleague = rankedData[0]['leagueName']
lolflexrank = rankedData[0]['tier'] + " " + rankedData[0]['rank']
lolflexpoints = rankedData[0]['leaguePoints']
lolsololeague = rankedData[1]['leagueName']
lolsolorank = rankedData[1]['tier'] + " " + rankedData[1]['rank']
lolsolopoints = rankedData[1]['leaguePoints']
lolsolowins = rankedData[1]['wins']
lolsololosses = rankedData[1]['losses']
return ("You are currently playing in " +str(lolsololeague)+" league and your solo rank is " + str(lolsolorank) + " with " + str(lolsolopoints) + " league points (LP)\n" +
"You won " +str(lolsolowins) + " and lost " + str(lolsololosses) +" games")