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]
-
- destroy()[source]
Detach underlying session.
The
close()
method should be used instead when possible as this function does not close the session’s connector.
- await get_player(player_id, platform=None)[source]
Get player skills for player ID by searching in all platforms.
- Parameters
- Returns
Requested player skills.
- Return type
- 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
- player_id
player_id
as passed toClient.get_player()
.- Type
- playlists
Dictionary mapping
PlaylistKey
withPlaylist
.- Type
- highest_tier
Highest tier of the player. Doesn’t include the playlists that don’t count towards season rewards.
- Type
- season_rewards
Season rewards info.
- Type
- 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.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
orint
- tier_estimates
Tier estimates for this playlist.
- Type
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.
- exception rlapi.errors.Unauthorized(response, data)[source]
Bases:
rlapi.errors.HTTPException
Exception that’s thrown when status code 401 occurs.