LoL.py
Table Of Contents
LoL.py
Table Of Contents

API Reference

This section is the bulk of the documentation and includes all objects that will interact with the API.

Client

class lol.Client(token: str, default_request_region: lol.enums.Region = <Region.NA1: 'na1'>, session: aiohttp.client.ClientSession = None, loop=None)[source]

Adds most of the base functionality for the module. Allows you interact and get things to interact with the API.

Parameters:
  • token (str) – The token to use when requesting the API.
  • default_request_region (Optional[Region]) – The region to request when no other region is supplied. Defaults to Region.NA1.
  • session (Optional[aiohttp.ClientSession]) – Used to supply a session if you dont want the Client creating it’s own.
  • loop (Optional[asyncio.AbstractEventLoop]) – Used to supply a loop if you dont want the Client using asyncio.get_event_loop()
loop

The used event loop.

Type:asyncio.AbstractEventLoop
default_request_region

The region to request when no other region is supplied.

Type:lol.Region
coroutine close(close_loop=False)[source]

This is used to close the session, which will disable all functionality.

Parameters:close_loop (bool) – This is used to decide whether or not to close the event loop. Defaults to False.
coroutine fetch_summoner(id=None, puuid=None, account_id=None, name=None, region: lol.enums.Region = None)[source]

This is used to get a Summoner. It requires only one of the parameters (not including region) to get a summoner.

Parameters:
  • id (str) – The id to search by.
  • puuid (str) – The puuid to search by.
  • account_id (str) – The id to search by.
  • id – The id to search by.
Returns:

Will return the summoner or will return None and raise

and error if the summoner couldn’t be found.

Return type:

(Optional[Summoner])

Raises:

DataNotFound – No summoner with that information was found.

Summoner

class lol.Summoner(client, region: lol.enums.Region, **data)[source]

Represents a League of Legends summoner.

name

The name of the summoner.

Type:str
puuid

The PUUID associated with the summoner.

Type:str
level

The current level for the summoner.

Type:int
id

The ID associated with the summoner.

Type:str
account_id

The account ID associated with the summoner.

Type:str
revision_date

The last time the summoner’s data was updated. This is server-side, keep in mind.

Type:datetime.datetime
profile_icon_id

The ID for the summoner’s profile icon.

Type:int
profile_icon

An Image which gives functionality for saving, reading, and accessing the url of the image.

Type:Image
region

The region the summoner is located in.

Type:Region

Media

class lol.Image(client, url)[source]

Adds functionality for images in the module.

client

The client responsible for the image’s creation and future requests.

Type:Client
url

The URL/location of the image which is used when reading and saving. It is also for use when you only needed the URL of the image.

Type:str
Parameters:
  • client (Client) – The client responsible for the image’s creation and future requests.
  • url (str) – The URL/location of the image which is used when reading and saving.
coroutine read()[source]

Read this image as bytes.

Returns:The bytes of the image.
Return type:bytes
coroutine save(b)[source]

Save this image.

Parameters:b (Union[BinaryIO, os.PathLike]) – The BinaryIO or os.PathLike to save to.

Table Of Contents