bayes_lol_client package¶
Modules¶
bayes_lol_client¶
bayes_lol_client.emh¶
- class bayes_lol_client.emh.BayesEMH(username: Optional[str] = None, password: Optional[str] = None, wait_on_ratelimit: Optional[bool] = True, retry_interval: Optional[int] = 2, max_retries: Optional[int] = 5)¶
Bases:
objectThis class makes requests to the /emh/v1 endpoint in the Bayes API. Useful to get summary/details/replay files of professional games
- DEFAULT_MAX_PAGE_SIZE = 500¶
- endpoint = 'https://lolesports-api.bayesesports.com/emh/v1/'¶
- get_asset(platform_game_id: str, asset_name: str) Response¶
Gets a generic asset for a game by its name (SUMMARY, DETAILS, or REPLAY)
- Parameters:
platform_game_id – A Riot esports game ID
asset_name – The name of the asset to return (GAMH_SUMMARY, GAMH_DETAILS, ROFL_REPLAY)
- Returns:
An asset for a specific game
- get_game_data(platform_game_id: str) tuple¶
Returns both the game summary and details as a tuple
- Parameters:
platform_game_id – A Riot esports game ID
- Returns:
Game summary and details as a tuple
- get_game_details(platform_game_id: str) dict¶
Returns the game details (timeline) as a json file
- Parameters:
platform_game_id – A Riot esports game ID
- Returns:
The game details (timeline) as a json file
- get_game_info(platform_game_id: str) dict¶
Gets basic metadata for a specific game
- Parameters:
platform_game_id – A riot esports game ID
- Returns:
Metadata for a game as a dict
- get_game_replay(platform_game_id: str) bytes¶
Returns a replay file as bytes which can later be saved locally
- Parameters:
platform_game_id – A Riot esports game ID
- Returns:
Replay file as bytes
- get_game_summary(platform_game_id: str) dict¶
Returns the game summary as a json file
- Parameters:
platform_game_id – A Riot esports game ID
- Returns:
The game summary as a json file
- get_games_info(platform_game_ids: Union[str, list]) dict¶
Gets basic metadata for a list of games
- Parameters:
platform_game_ids – Riot esports game IDs as a list or a comma-separated string
- Returns:
A dict containing each platform game ID as a key
- get_games_list(*, tags: Optional[Union[str, List[str]]] = None, from_timestamp: Optional[Union[datetime, int, float]] = None, to_timestamp: Optional[Union[datetime, int, float]] = None, limit: Optional[int] = None, team1: Optional[str] = None, team2: Optional[str] = None, max_page_size: Optional[int] = None) list¶
Gets a list of games which can be filtered using the different function parameters If no limit is specified, the function will make multiple requests and return every matched game
- Parameters:
tags – Only return games containing these tags, as a comma-separated string, or a list
from_timestamp – Only return games after this moment, can be a unix epoch timestamp as int or float, or a datetime object
to_timestamp – Only return games before this moment, can be a unix epoch timestamp as int or float, or a datetime object
limit – Maximum number of games to return
team1 – Only return games where this team played, this should be the team tricode
team2 – Only return games where this team and team1 played, this should be the team tricode
max_page_size – Maximum size for each request, this is only useful for tweaking performance
- Returns:
A dict of games with the ID as a key and metadata for each one
- get_tags_list() List[str]¶
Gets all the available game tags in EMH
- Returns:
A list of game tags
bayes_lol_client.historic¶
- class bayes_lol_client.historic.BayesHistoric(username: Optional[str] = None, password: Optional[str] = None, wait_on_ratelimit: bool = True, retry_interval: int = 2, max_retries: int = 5)¶
Bases:
object- DEFAULT_MAX_PAGE_SIZE = 500¶
- endpoint = 'https://lolesports-api.bayesesports.com/historic/v1/riot-lol/'¶
- get_asset(service: str)¶
- get_game_data(game_id: Union[str, int]) <property object at 0x7fb4b4a45890>¶
- get_game_data_dump(game_id: Union[str, int]) dict¶
- get_league_info(league_id: Union[str, int]) dict¶
- get_league_tournaments_list(league_id: Union[str, int]) list¶
- get_leagues_info(league_ids: Union[str, List[Union[int, str]]]) dict¶
- get_match_info(match_id: Union[int, str]) dict¶
- get_matches_info(match_ids: Union[str, List[Union[int, str]]]) dict¶
- get_matches_list(*, match_or_game_id: Optional[Union[str, int]] = None, team_ids: Optional[Union[str, int, List[int]]] = None, league_ids: Optional[Union[str, int, List[int]]] = None, date_from: Optional[Union[datetime, int, float]] = None, date_to: Optional[Union[datetime, int, float]] = None, limit: Optional[int] = None, max_page_size: Optional[int] = None) list¶
- get_teams_list() list¶
- get_tournament_info(tournament_id: Union[str, int]) dict¶
- get_tournament_matches_list(tournament_id: Union[str, int]) list¶
- get_tournaments_info(tournament_ids: Union[str, List[Union[int, str]]]) dict¶
- get_tournaments_list(league_ids: Union[List[int], str, int]) list¶
- get_user_leagues_list() list¶
bayes_lol_client.api¶
- class bayes_lol_client.api.BayesAPIClient(endpoint, max_retries: int, retry_interval: int, username: Optional[str] = None, password: Optional[str] = None, wait_on_ratelimit: bool = True)¶
Bases:
object- auth_endpoint = 'https://lolesports-api.bayesesports.com/auth/'¶
- config_path = '/home/docs/.config/bayes_lol_client'¶
- credentials_file = '/home/docs/.config/bayes_lol_client/credentials.json'¶
- do_api_call(method: str, service: str, data: Optional[dict] = None, allow_retry: bool = True, ensure_login: bool = True, sleeper: Optional[Sleeper] = None, endpoint: Optional[str] = None) Any¶
- do_login() NoReturn¶
- ensure_login() NoReturn¶
- get_user_tokens_file() str¶
- handle_response(sleeper: Sleeper, response: Response, allow_retry: bool, callback: Callable, return_json: bool = True, **kwargs)¶
- load_all() NoReturn¶
- load_credentials() NoReturn¶
- load_user_tokens() NoReturn¶
- static make_http_exception_from_status_code(response: Response)¶
- refresh_token() NoReturn¶
- should_refresh() bool¶
- static sleep_and_retry(sleeper: Sleeper, callback: Callable, exception: Optional[Exception] = None, sleep_time: Optional[int] = None, **kwargs)¶
- store_tokens(data: dict) NoReturn¶
bayes_lol_client.errors¶
- exception bayes_lol_client.errors.ClientError(status_code)¶
Bases:
ExceptionAn error occurred on the client side
- exception bayes_lol_client.errors.NotFoundError(status_code)¶
Bases:
ClientErrorThe server cannot find the requested resource
- exception bayes_lol_client.errors.ServerError(status_code)¶
Bases:
ExceptionAn error occurred on the server side
- exception bayes_lol_client.errors.TooManyRequests(status_code)¶
Bases:
ClientErrorThe user has sent too many requests to the server in a given amount of time
- exception bayes_lol_client.errors.UnauthorizedError(status_code)¶
Bases:
ClientErrorThe client request has not been completed because it lacks valid authentication credentials for the requested resource
bayes_lol_client.utils¶
- bayes_lol_client.utils.download_game_asset(api: BayesAPIClient, asset_url: str, sleeper: Optional[Sleeper] = None) Response¶
- bayes_lol_client.utils.get_list(api: BayesAPIClient, params: dict, service: str, limit: int, key: str) list¶
- bayes_lol_client.utils.join_if_needed(_list)¶
- bayes_lol_client.utils.process_datetime(date: Optional[Union[datetime, int, float]]) Optional[str]¶