![]() # A list of all the participants puuids participants = match_data # Now, find where in the data our players puuid is found player_index = participants.index(puuid) # Hopefully the name below is what you inputted into the first function! print(match_data) ![]() To do this, grab a list of all the participant puuids and use the “index” function to find out where they are. In order to do this, we need to find in which order they appear. However, we don’t want the information about any random player in that game! We want to find out how the summoner we searched for originally had performed. Let’s take a look at one of the players KDA: # To save time, we'll assign a variable for the first player player_data = match_data k = player_data d = player_data a = player_data print("Kills:", k) print("Deaths:", d) print("Assists:", a) print("KDA:", (k + a) / d) It also contains information about each player and their performance, such as KDA or their champions name. It contains all the information about the match such as game length, start time and which puuids were in the game. If all goes well you’ll find A LOT of fields in the “match_data” object. api_url = " " # This one doesn't have any arguments (see, there's no "?" above) so we'll add it with the api key api_url = api_url + '?api_key=' + api_key resp = requests.get(api_url) match_data = resp.json() We can then copy the API URL and send it off through Python. In the portal, scroll down and copy one of the match IDs into the “matchId” input, ensuring the region and API key are the same as before. You’re looking for the one called “/lol/summoner/v4/summoners/by-name/”. Scroll down until you see “SUMMONER-V4”, once you click it a list of URLs will appear. On your left should be a list of all the available types of calls to be made - don’t be overwhelmed, they cover all Riot games and in reality you’ll only need to use a small number of them. To find all the ones available to you, tab back into the developer portal and press “APIs”. In order to do this, we need to find the API that we want to call, which is in the form of a URL. It’s time to make our first call to the Riot API. Remember, never share this key with anyone else and be careful where you store it! You can then copy it over to your Python interpreter, if you’re following the guide exactly it’ll be Jupyter Notebook. Once you’re in, head down to “REGENERATE YOUR API KEY” to get a temporary pass (lasts 24 hours). Head over to: and sign-in using your Riot account. To begin working with the Riot API, we must first set-up an account on the portal. Getting Setup on the Riot API Developer Portal I have also created this guide in the form of a notebook, which can be found here: Ī whole bunch of people with various background knowledge have helped me test this guide out, if you need some help you can join the iTero Discord and get advise, fix issues or find out more in the #riot-api-learners channel. Install Jupyter Notebook through Anaconda: If you are new to Python, I recommend using Jupyter Notebooks - since it makes understanding what the code is doing a lot easier. ![]() I won’t write a guide on learning Python since there’s millions out there, but hopefully the guide will give you the basics and you can go off and learn the rest yourself. You can learn the basics of coding AND the basics of the API at the same time. When I first looked at the Riot API I didn’t know anything about coding and now I do it as a full time profession. ![]() You’ll find everything you need here to create your very first account analyser.īefore we start… Do I need to know how to code? An introductory guide on how to get League of Legends data from the Riot API, using Python.Ī slightly different one for you guys this week - instead of showing you a statistical analysis, I’ll be teaching you how to do statistical analysis! We’re starting this series off with an introduction to the Riot API.
0 Comments
Leave a Reply. |