PUBG API Model Factory¶
The chicken_dinner.pubgapi.PUBG class provides responses to the PUBG
JSON API as type classes that represent the API objects, e.g. Season,
Player, Match, etc. These models provide interfaces for
accessing related model objects via the JSON API, without having to construct
API queries or URLs for requests. You can view the docs for the models
here: API Models.
Each of the response object models also provides access to the lower level
JSON response via the response attribute.
Warning
(new in 0.4.0) PUBGCore (and PUBG) instances provide a built-in rate limiter which sleeps based on the API call being made and the rate limit information contained in the response headers. When rate limited, these classes will emit a warning to the console.
PUBGCore will attempt to avoid 429 (rate limited) responses altogether, but if a 429 response does occur, the client will sleep and attempt one retry before raising an exception.
-
class
chicken_dinner.pubgapi.PUBG(api_key, shard=None, gzip=True)[source]¶ High level type-based interface to the PUBG JSON API.
- Parameters
api_key (str) – your PUBG api key
shard (str) – (optional) a shard to use for all requests with this instance
gzip (bool) – (default=*True*) whether to gzip the responses. Responses are automatically unzipped by the underlying
requestslibrary.
-
property
api_key¶ The API key being used.
-
current_season(shard=None)[source]¶ Get the current season.
- Parameters
shard (str) – (optional) the shard to use if different from the instance shard
- Returns
a
chicken_dinner.models.Seasonobject for the current season
-
leaderboard(game_mode, shard=None)[source]¶ Get a leaderboard for a game mode.
- Parameters
game_mode (str) – the game mode for which to fetch the leaderboard
shard (str) – (optional) the shard to use if different from the instance shard
- Returns
a
chicken_dinner.models.Leaderboardobject containing information about top players for the specified game mode
-
lifetime(player_id, shard=None)[source]¶ Get a player’s information for their player lifetime.
- Parameters
player_id (str) – the player’s account id
shard (str) – (optional) the shard to use if different from the instance shard
- Returns
a
chicken_dinner.models.PlayerSeasonobject containing information about statistics for a player’s lifetime performance
-
match(match_id, shard=None)[source]¶ Get match info by
match_id.- Parameters
match_id (str) – the match_id to query
shard (str) – (optional) the shard to use if different from the instance shard
- Returns
a
chicken_dinner.models.Matchobject for the match corresponding tomatch_id.
-
player(player_id, shard=None)[source]¶ Get a player’s metadata.
- Parameters
player_id (str) – the player’s account id
shard (str) – (optional) the shard to use if different from the instance shard
- Returns
a
chicken_dinner.models.Playerobject containing information about the player
-
player_season(player_id, season_id, shard=None)[source]¶ Get a player’s information for a particular season.
- Parameters
player_id (str) – the player’s account id
season_id (str) – the PUBG season id or “current” for current season
shard (str) – (optional) the shard to use if different from the instance shard
- Returns
a
chicken_dinner.models.PlayerSeasonobject containing information about matches and statistics for a player’s performance in the season given byseason_id
-
players(filter_type, filter_value, shard=None)[source]¶ Get multiple players’ metadata.
- Parameters
filter_type (str) – query by either “player_ids” or “player_names”
filter_value (list) – a list of strings of the
player_idsorplayer_namesto searchshard (str) – (optional) the shard to use if different from the instance shard
- Returns
an iterable
chicken_dinner.models.Playersobject consisting of multiplechicken_dinner.models.Playerobjects
-
players_from_ids(player_ids, shard=None)[source]¶ Get multiple players’ metadata from a list of
player_ids.- Parameters
player_ids (list) – a list of strings of
player_idsshard (str) – (optional) the shard to use if different from the instance shard
- Returns
an iterable
chicken_dinner.models.Playersobject consisting of multiplechicken_dinner.models.Playerobjects
-
players_from_names(player_names, shard=None)[source]¶ Get multiple players’ metadata from a list of
player_names.- Parameters
player_names (list) – a list of strings of
player_namesshard (str) – (optional) the shard to use if different from the instance shard
- Returns
an iterable
chicken_dinner.models.Playersobject consisting of multiplechicken_dinner.models.Playerobjects
-
samples(start=None, shard=None)[source]¶ Get match samples.
- Parameters
start (str) – (optional) the start timestamp from which to get samples
shard (str) – (optional) the shard to use if different from the instance shard
- Returns
a
chicken_dinner.models.Samplesobject containing match samples.
-
seasons(shard=None)[source]¶ Get an iterable of PUBG seasons.
- Parameters
shard (str) – (optional) the shard to use if different from the instance shard
- Returns
an iterable
chicken_dinner.models.Seasonsobject containing multiplechicken_dinner.models.Seasonobjects.
-
property
shard¶ The current shard being used.
-
status()[source]¶ Get the status of the PUBG API.
- Returns
a
chicken_dinner.models.Statusobject containing information about the status of the API.
-
telemetry(url, map_assets=False)[source]¶ Get a telemetry object from a telemetry url.
- Parameters
url (str) – the url for the telemetry data
map_assets (bool) – whether to map asset ids to named values, e.g. map
Item_Weapon_AK47_CtoAKM.
- Returns
-
tournament(tournament_id)[source]¶ Get a tournament by its id.
- Parameters
tournament_id (str) – the tournament id for which to get data
- Returns
a
chicken_dinner.models.Tournamentobject
-
tournaments()[source]¶ Get a list of tournaments.
- Returns
a
chicken_dinner.models.Tournamentsobject