API Reference

The following section outlines the API of rlapi.

Note

This module uses the Python logging module to log diagnostic and errors in an output independent way. If the logging module is not configured, these logs will not be output anywhere.

Client

class rlapi.Client(*, client_id, client_secret, tier_breakdown=None)[source]
await close()[source]

Close underlying session.

Release all acquired resources.

destroy()[source]

Detach underlying session.

The close() method should be used instead when possible as this function does not close the session’s connector.

update_client_credentials(*, client_id, client_secret)[source]

Update client ID and client secret.

Parameters
  • client_id (str) – New client ID.

  • client_secret (str) – New client secret.

await get_player(player_id, platform=None)[source]

Get player skills for player ID by searching in all platforms.

Parameters
  • player_id (str) – ID of player to find.

  • platform (Platform, optional) – Platform to search, if not provided client will search on all platforms.

Returns

Requested player skills.

Return type

tuple of Player

Raises
  • HTTPException – HTTP request to Rocket League or Steam API failed.

  • PlayerNotFound – The player could not be found on any platform.

Enumerations

The API provides some enumerations for certain types of string to avoid the API from being stringly typed in case the strings change in the future.

All enumerations are subclasses of enum.Enum.

class rlapi.PlaylistKey(value)[source]

Represents playlist’s key.

str(x)

Returns playlist’s friendly name, e.g. “Solo Duel”

solo_duel = 10

The Solo Duel playlist.

doubles = 11

The Doubles playlist.

standard = 13

The Standard playlist.

hoops = 27

The Hoops playlist.

rumble = 28

The Rumble playlist.

dropshot = 29

The Dropshot playlist.

snow_day = 30

The Snow Day playlist.

tournaments = 34

The Tournaments “playlist”. This is used to determine the rank for automatic tournaments.

class rlapi.Platform(value)[source]

Represents player’s platform.

str(x)

Returns platform’s friendly name, e.g. “Xbox One”

steam = 'Steam'

The Steam platform.

ps4 = 'PS4'

The PlayStation 4 platform.

xboxone = 'XboxOne'

The Xbox One platform.

epic = 'Epic'

The Epic Games platform.

switch = 'Switch'

The Nintendo Switch platform.

Rocket League API Models

Models are classes that are received from Rocket League API and are not meant to be created by the user of the library.

class rlapi.Player[source]

Represents Rocket League Player

platform

Player’s platform.

Type

Platform

player_id

player_id as passed to Client.get_player().

Type

str

user_id

Player’s user ID. Only present for Steam and Epic Games players.

Type

str, optional

user_name

Player’s username (display name).

Type

str

playlists

Dictionary mapping PlaylistKey with Playlist.

Type

dict

tier_breakdown

Tier breakdown.

Type

dict

highest_tier

Highest tier of the player. Doesn’t include the playlists that don’t count towards season rewards.

Type

int

season_rewards

Season rewards info.

Type

SeasonRewards

get_playlist(playlist_key)[source]

Get playlist for the player.

Parameters

playlist_key (PlaylistKey) – PlaylistKey for playlist to get.

Returns

Playlist object for provided playlist key.

Return type

Playlist, optional

class rlapi.SeasonRewards[source]

Represents season rewards informations.

level

Player’s season reward level.

Type

int

wins

Player’s season reward wins.

Type

int

can_advance

Tells if player can advance in season rewards.

Type

bool

class rlapi.Playlist[source]

Represents Rocket League playlist stats data.

str(x)

Returns playlist’s rank string, e.g. “Champion I Div III”

key

Playlist’s key. Might be int, if that key is not within the ones recognised by the enumerator.

Type

PlaylistKey or int

tier

Tier on this playlist.

Type

int

division

Division on this playlist.

Type

int

mu

Mu on this playlist.

Type

float

skill

Skill rating on this playlist.

Type

int

sigma

Sigma on this playlist.

Type

float

win_streak

Win streak on this playlist.

Type

int

matches_played

Amount of matches played on this playlist.

Type

int

breakdown

Playlist tier breakdown.

Type

dict

tier_estimates

Tier estimates for this playlist.

Type

TierEstimates

class rlapi.tier_estimates.TierEstimates[source]

Represents Rocket League playlist’s tier estimates.

playlist

Playlist object which these estimates are about.

Type

rlapi.Playlist

tier

Estimated tier on this playlist.

Type

int

division

Estimated division on this playlist.

Type

int

div_down

Estimated amount of points for player to go a division down.

Type

int, optional

div_up

Estimated amount of points for player to go a division up.

Type

int, optional

tier_down

Estimated amount of points for player to go a tier down.

Type

int, optional

tier_up

Estimated amount of points for player to go a tier up.

Type

int, optional

Exceptions

The following exceptions are thrown by the library.

exception rlapi.errors.RLApiException[source]

Bases: Exception

Base exception class for Rocket League API.

exception rlapi.errors.IllegalUsername[source]

Bases: rlapi.errors.RLApiException

Username has unallowed characters.

exception rlapi.errors.PlayerNotFound[source]

Bases: rlapi.errors.RLApiException

Username could not be found.

exception rlapi.errors.HTTPException(response, data)[source]

Bases: rlapi.errors.RLApiException

Exception that’s thrown when an HTTP request operation fails.

response

The response of the failed HTTP request.

Type

aiohttp.ClientResponse

status

The status code of the HTTP request.

Type

int

message

Details about error.

Type

Union[str, dict]

exception rlapi.errors.Unauthorized(response, data)[source]

Bases: rlapi.errors.HTTPException

Exception that’s thrown when status code 401 occurs.