Skip to content

Instantly share code, notes, and snippets.

@BarneyH19
BarneyH19 / riot_api_1.py
Created March 20, 2020 01:10
riot_api_1
from riotwatcher import LolWatcher, ApiError
import pandas as pd
# golbal variables
api_key = 'RGAPI-xxxxx'
watcher = LolWatcher(api_key)
my_region = 'na1'
me = watcher.summoner.by_name(my_region, 'Doublelift')
print(me)
@BarneyH19
BarneyH19 / riot_api_6.json
Last active March 20, 2020 20:48
riot_api_6
{
"leagueId":"c60807e8-6afb-38fd-ab9b-ae8588dc8b27",
"queueType":"RANKED_SOLO_5x5",
"tier":"CHALLENGER",
"rank":"I",
"summonerId":"6CfZ3nw63SwMi1e786wyzoMJNMXW0RJst0Dsgyy5mw7dmjw",
"summonerName":"Doublelift",
"leaguePoints":931,
"wins":160,
"losses":133,
{
"id": "6CfZ3nw63SwMi1e786wyzoMJNMXW0RJst0Dsgyy5mw7dmjw",
"accountId": "bNDTw_Yf9nAiNKHKsZvbNByeq2Pi2uZy1UaJU5uuFjnmeA",
"puuid": "ROvZTmgICKryAwCYSqestOz-zohYGS2PCthSNGzuVKsn5OMGz6QgHzKOuDyXAnSwgJMvwvg3ilREVA",
"name": "Doublelift",
"profileIconId": 3270,
"revisionDate": 1584594439000,
"summonerLevel": 171
}
@BarneyH19
BarneyH19 / riot_api_4.py
Created March 20, 2020 00:51
riot_api_4
# check league's latest version
latest = watcher.data_dragon.versions_for_region(my_region)['n']['champion']
# Lets get some champions static information
static_champ_list = watcher.data_dragon.champions(latest, False, 'en_US')
# champ static list data to dict for looking up
champ_dict = {}
for key in static_champ_list['data']:
row = static_champ_list['data'][key]
champ_dict[row['key']] = row['id']
@BarneyH19
BarneyH19 / riot_api_3.py
Created March 20, 2020 00:50
riot_api_3
my_matches = watcher.match.matchlist_by_account(my_region, me['accountId'])
# fetch last match detail
last_match = my_matches['matches'][0]
match_detail = watcher.match.by_id(my_region, last_match['gameId'])
participants = []
for row in match_detail['participants']:
participants_row = {}
participants_row['champion'] = row['championId']
@BarneyH19
BarneyH19 / riot_api_2.py
Created March 20, 2020 00:49
riot_api_2
# Return the rank status for Doublelift
my_ranked_stats = watcher.league.by_summoner(my_region, me['id'])
print(my_ranked_stats)