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 requests library.

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.Season object 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.Leaderboard object 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.PlayerSeason object 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.Match object for the match corresponding to match_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.Player object 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.PlayerSeason object containing information about matches and statistics for a player’s performance in the season given by season_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_ids or player_names to search

  • shard (str) – (optional) the shard to use if different from the instance shard

Returns

an iterable chicken_dinner.models.Players object consisting of multiple chicken_dinner.models.Player objects

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_ids

  • shard (str) – (optional) the shard to use if different from the instance shard

Returns

an iterable chicken_dinner.models.Players object consisting of multiple chicken_dinner.models.Player objects

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_names

  • shard (str) – (optional) the shard to use if different from the instance shard

Returns

an iterable chicken_dinner.models.Players object consisting of multiple chicken_dinner.models.Player objects

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.Samples object 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.Seasons object containing multiple chicken_dinner.models.Season objects.

property shard

The current shard being used.

status()[source]

Get the status of the PUBG API.

Returns

a chicken_dinner.models.Status object 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_C to AKM.

Returns

a chicken_dinner.models.telemetry.Telemetry object

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.Tournament object

tournaments()[source]

Get a list of tournaments.

Returns

a chicken_dinner.models.Tournaments object