Exemple #1
0
def delete_pre_end_of_game(connection: LeagueConnection):
    ''' Deletes pre end of game sequence event '''
    res = connection.get('/lol-pre-end-of-game/v1/currentSequenceEvent')
    res_json = res.json()
    name = res_json['name']
    connection.post('/lol-pre-end-of-game/v1/complete/%s' % name)
    connection.delete('/lol-pre-end-of-game/v1/registration/%s' % name)
Exemple #2
0
def get_queue_id(connection: LeagueConnection):
    ''' Returns the current queue id if exists else returns -1 '''
    res = connection.get('/lol-lobby/v2/lobby')
    res_json = res.json()
    if res.status_code == 404:
        return -1
    return res_json["gameConfig"]["queueId"]
Exemple #3
0
def catalog(connection: LeagueConnection, item_type):
    ''' Parses the item catalog for a item type '''
    url = '/lol-store/v1/catalog?inventoryType=["%s"]' % item_type
    res = connection.get(url)
    if not res.ok:
        return None
    return res.json()
Exemple #4
0
def get_icon(connection: LeagueConnection):
    ''' Parses the current summoner icon '''
    try:
        res = connection.get('/lol-summoner/v1/current-summoner')
        res_json = res.json()
        return res_json["profileIconId"]
    except requests.RequestException:
        return -1
def get_champion_select_data(connection: LeagueConnection):
    ''' Checks if in champ select '''
    res = connection.get('/lol-champ-select/v1/session')
    res_json = res.json()
    if res.status_code == 404:
        return None
    completed_list = []
    for action_list in res_json['actions']:
        for action in action_list:
            completed_list.append(action['completed'])
    if all(completed_list):
        return None
    return res_json
Exemple #6
0
def get_honor_data(connection: LeagueConnection):
    ''' Gets a random player data for honoring if exists '''
    res = connection.get('/lol-honor-v2/v1/ballot')
    res_json = res.json()
    players = res_json['eligiblePlayers']
    if players == []:
        return None
    game_id = res_json['gameId']
    player = random.choice(players)
    data = {
        'gameId': game_id,
        'summonerId': player['summonerId'],
    }
    return data
def get_pickable_champs(connection: LeagueConnection):
    ''' Fetches pickable champions, probably depricaed in patch 9.24 '''
    res = connection.get('/lol-champ-select/v1/pickable-champions')
    res_json = res.json()
    return res_json['championIds']