API Reference

Clients

class lolrune.RuneClient(session=None)

A client which allows you get a champion’s optimal runes. You can find a brief example here.

Parameters:session (requests.Session, optional) – The main session which is used to make all requests. If one is not passed, one will be created.
HEADERS

dict – Firefox headers for the particular version used to inspect the html.

URL

str – The runeforge.gg url used in requests.

dict – A dict containing all champ’s individual rune pages.

Note

The rune_links data is structured like so:

{
  "aatrox": [
    "http://runeforge.gg/loadouts/die-and-be-forgotten/"
  ],
  "ahri": [
    "http://runeforge.gg/loadouts/the-poking-fox/",
    "http://runeforge.gg/loadouts/burst-snowball-carry/"
  ], ...
}
get_raw(champion_name)

The main method to retrieve raw optimal runes for a given champion.

Parameters:champion_name (str) – Case insensitive name of the champion to get runes for.
Return type:Tuple[dict]
Returns:Tuple[dict] – A tuple of dicts which contain the rune information.

Note

Please see Raw return formatting for more information on the return type.

Raises:ChampNotFoundError – If the champion is not found in self.rune_links.
get_runes(champion_name)

A method to retrieve a champion’s runepage objects.

Parameters:champion_name (str) – Case insensitive name of the champion to get runes for.
Return type:Tuple[Champion]
Returns:Tuple[Champion] – A tuple of Champions.

Note

Please see Abstract return formatting and Champion for more information on the return type.

Raises:ChampNotFoundError – If the champion is not found in self.rune_links.
update_champs()

A method which updates self.rune_links. This is useful because runeforge.gg is frequently updating.

Raises:RuneConnectionError – If the GET response status is not 200.
class lolrune.AioRuneClient(session=None, loop=None)

An asynchronous version of RuneClient used to fetch optimal runes for champions. You can find a brief example here.

Parameters:
  • session (aiohttp.ClientSession, optional) – The aiohttp session used in all requests. If none is provided, a new session will be created.
  • loop (asyncio.AbstractEventLoop, optional) – The asyncio event loop. If none is provided, a new loop will be created.
HEADERS

dict – Firefox headers for the particular version used to inspect the html.

URL

str – The runeforge.gg url used in requests.

dict – A dict containing all champ’s individual rune pages.

Note

The rune_links data is structured like so:

{
  "aatrox": [
    "http://runeforge.gg/loadouts/die-and-be-forgotten/"
  ],
  "ahri": [
    "http://runeforge.gg/loadouts/the-poking-fox/",
    "http://runeforge.gg/loadouts/burst-snowball-carry/"
  ], ...
}
coroutine get_raw(self, champion_name)

A method to retrieve raw optimal runes for a given champion.

Parameters:champion_name (str) – Case insensitive name of the champion to get runes for.
Return type:Tuple[dict]
Returns:Tuple[dict] – A tuple of dicts which contain the rune information.

Note

Please see Raw return formatting for more information on the return type.

Raises:ChampNotFoundError – If the champion is not found in self.rune_links.
coroutine get_runes(self, champion_name)

A method to retrieve a champion’s runepage objects.

Parameters:champion_name (str) – Case insensitive name of the champion to get runes for.
Return type:Tuple[Champion]
Returns:Tuple[Champion] – A tuple of Champions.

Note

Please see Abstract return formatting and Champion for more information on the return type.

Raises:ChampNotFoundError – If the champion is not found in self.rune_links.
coroutine update_champs()

A method which updates self.rune_links. This is useful because runeforge.gg is frequently updating.

Raises:RuneConnectionError – If the request does not return with a status of 200.

Data Classes

class lolrune.Champion(rune_data)

Represents a champion and contains that champ’s rune page.

Parameters:rune_data (dict) – The entirety of the rune page data returned by RuneClient.get_raw() and AioRuneClient.get_raw().
name

str – The champion’s name e.g. 'Kalista'.

title

str – The title assigned to the particular champion’s rune page by runeforge.gg. This is largely meaningless, e.g. 'Bloodshed Carries a Price'.

description

str – A slightly less meaningless description of the rune page e.g., 'Lethality focused long range poke with [Q].'.

runes

RunePage – Contains rune information.

url

str – The runeforge page for the specific rune page.

Note

For more information on this object and other data objects, please see Abstract return formatting

class lolrune.RunePage(rune_page)

An object representing a specific rune page for a Champion.

Parameters:rune_page (dict) – The nested data contained in rune_data['runes'].
keystone

str – The keystone for the page, e.g. 'Arcane Comet'.

primary

Tree – A representation of the primary rune tree.

secondary

Tree – A representation of the secondary rune tree.

Note

For more information on this object and other data objects, please see Abstract return formatting

class lolrune.Tree(name, runes)

A namedtuple which represents a specific tree in a RunePage.

name

str – The name of the rune tree, e.g. 'Precision'.

runes

List[str] – A list of runes in a page, e.g.:

['Cheap Shot', 'Ghost Poro', 'Relentless Hunter']

Exceptions

exception lolrune.LoLRuneException

Base exception for library exceptions.

exception lolrune.RuneConnectionError(status)

Raised when a request does not have a status of 200.

Parameters:status (int) – The status of the request which failed.
exception lolrune.ChampNotFoundError(champ)

Raised when a champion is not found in self.rune_links.

Parameters:champ (str) – The champion which was not found.