API Models

The chicken_dinner.pubgapi.PUBG class returns type instances that are associated with the resources from the PUBG JSON API. These objects pass the PUBG object (and shard) between themselves so that related objects can be generated from one another with method calls.

Each of the API model objects also provides a response attribute that contains the deserialized JSON response for the associated API call.

Match Models

See Match Detail Models for detailed match-level models.

Season Models

Models related to season objects and metadata.

class chicken_dinner.models.Season(pubg, data, shard=None)[source]

Single season model.

An object containing metadata about a PUBG season.

Parameters
  • pubg – an instance of the class chicken_dinner.pubgapi.PUBG

  • data – the data payload from a season response

  • shard – the shard for the season response

data = None

The data payload for this season

get_player(player_id)[source]

Get a player-season dataset for this season.

Parameters

player_id – a player account id or instance of chicken_dinner.models.Player to retrieve data for this season

Returns

a chicken_dinner.models.PlayerSeason for this player_id

property id

The season id.

is_current()[source]

Return True if this season is the current season.

is_offseason()[source]

Return True if this season is in the offseason.

property shard

The shard for this season.

class chicken_dinner.models.Seasons(pubg, shard=None)[source]

Seasons model.

An iterable containing instances of the class chicken_dinner.models.Season for each season.

Parameters
current()[source]

Get the current season.

Returns

a chicken_dinner.models.Season instance for the current season

property data

The seasons’ data payload from the response.

property ids

Get a list of the season ids.

response = None

The API response for this object

property shard

The shard for this player.

property url

The url for the model response.

Player Models

Models related to player objects, stats, and metadata.

class chicken_dinner.models.Leaderboard(pubg, game_mode, shard=None)[source]

Leaderboard model.

An object for a leaderboard and its top players.

Parameters
  • pubg – an instance of the class chicken_dinner.pubgapi.PUBG

  • game_mode (str) – the game mode for the leaderboard

  • shard (str) – the shard for the seasons response

data(rank)[source]

The player raw data blob from the response for the player at the given rank.

property game_mode

The game mode for this leaderboard

get_player(rank)[source]

Get a player object for the player at the given rank.

id(rank)[source]

The player_id of the player at the given rank.

property ids

The player ids from this leaderboard in rank order.

ids_to_names()[source]

A map of player ids to names.

name(rank)[source]

The name of the player at the given rank.

property names

The player names from this leaderboard in rank order.

names_to_ids()[source]

A map of player names to ids

property shard

The shard for this leaderboard.

stats(rank)[source]

The player stats for the player at the given rank.

to_table(exclude_fields=None)[source]

Create a string representing the leaderboard and stats.

fields are:

“rank”, “id”, “name”, “rank_points”, “wins”, “games”, “win_ratio”, “average_damage”, “kills”, “kill_death_ratio”, “average_rank”

Parameters

exclude_fields (list(str)) – a list of fields to include

property url

A URL for this leaderboard resource.

class chicken_dinner.models.Player(pubg, player_id, data=None, shard=None)[source]

Player model.

An object encapsulating metadata about a PUBG player.

Parameters
  • pubg – an instance of the class chicken_dinner.pubgapi.PUBG

  • player_id (str) – the player’s account id

  • data (dict) – (optional) the data payload from the player response

  • shard (str) – the shard for the seasons response

property data

The data payload of the player response.

classmethod from_data(pubg, data, shard=None)[source]

Constructor for a player object with a data payload.

Parameters
  • pubg – an instance of the class chicken_dinner.pubgapi.PUBG

  • data (dict) – the data payload from the player response

  • shard (str) – the shard for the seasons response

get_current_season()[source]

Get the player-season data for the current season.

Returns

a chicken_dinner.models.PlayerSeason instance for the current season

get_season(season_id)[source]

Get a season response for a specific season.

Parameters

season_id – a season_id or chicken_dinner.models.Season object from which to get player-season data. Use the string “current” to get the current season.

Returns

a chicken_dinner.models.PlayerSeason instance

property id

The player account id.

property match_ids

A list of the player’s most recent match ids (most recent first).

property name

The player’s in-game name.

property patch_version

The last patch version on which the player has played.

response = None

The API response for this object.

property shard

The shard for this player.

property stats

Stats for the player.

property title_id

The title_id for the data.

property url

The URL for this player resource.

class chicken_dinner.models.Players(pubg, filter_type, filter_value, shard=None)[source]

Players model.

An iterable containing multiple instances of the class chicken_dinner.models.Player.

Parameters
  • pubg – an instance of the class chicken_dinner.pubgapi.PUBG

  • filter_type (str) – either “player_ids” or “player_names”

  • filter_value (list) – a list of player_ids or player_names corresponding to the filter_type parameter

  • shard (str) – the shard for the seasons response

property data

The data payload of the repsonse.

filter_type = None

The filter type for this Players query

filter_value = None

The filter value for this Players query

property ids

A list of player ids corresponding to the players.

ids_to_names()[source]

Construct a mapping of player_id to player_name.

property names

A list of player names corresponding to the players.

names_to_ids()[source]

Construct a mapping of player_name to player_id.

response = None

The API response for this object

property shard

The shard for this player.

shared_matches()[source]

Return a list of matches in which all players participated.

Returns

list of match_ids

property url

The URL for this players resource.

class chicken_dinner.models.PlayerSeason(pubg, player_id, season_id, shard=None)[source]

Player-season model.

An object containing data about a player’s season (or lifetime) data and stats.

Parameters
  • pubg – an instance of the class chicken_dinner.pubgapi.PUBG

  • player_id (str) – the player’s account id

  • season_id (str) – a season id for the player data

  • shard (str) – the shard for the seasons response

property data

The data payload from the response.

game_mode_stats(group=None, perspective=None)[source]

Get game mode states for a group-perspective (game mode).

Parameters
  • group (str) – (optional) either solo, duo, or squad. If not specified returns stats for all group modes

  • perspective (str) – (optional) either tpp or fpp. If not specified returns stats for all perspectives

property id

The ids of the player and season.

Returns

a dict with keys player_id and season_id

match_ids(group=None, perspective=None, flat=False)[source]

Get recent match_ids for a group-perspective (game mode).

Parameters
  • group (str) – (optional) either solo, duo, or squad. If not specified returns match_ids for all group modes

  • perspective (str) – (optional) either tpp or fpp. If not specified returns match_ids for all perspectives

  • flat (bool) – if True returns match ids in a list

property player_id

The player’s account id.

response = None

The API response for this object.

property season_id

The season id.

property shard

The shard for this player-season.

property url

A URL for this player-season resource.

Other Models

class chicken_dinner.models.Status(pubg)[source]

Status model.

Contains information about the status of the PUBG API.

Parameters

pubg – an instance of the chicken_dinner.pubgapi.PUBG class

property data

The status data payload.

property id

Get the id of the status.

refresh()[source]

Refresh the api status.

property released_at

Get the timestamp this version was released.

response = None

The API response for this object

property url

The status endpoint URL.

property version

Get the API version.

class chicken_dinner.models.Samples(pubg, start=None, shard=None)[source]

Samples model.

An object containing sample match data for a PUBG shard.

Parameters
  • pubg – an instance of the class chicken_dinner.pubgapi.PUBG

  • start – (optional) the timestamp from which samples are generated

  • shard – the shard for the samples response

property created_at

The timestamp on which the set of samples was created.

property data

The data payload of the samples response.

property id

An id for the samples.

property match_ids

A list of match ids from the samples response.

response = None

The API response for this object

property shard

The shard for this player.

start = None

The start timestamp for this set of samples

property title_id

The title id associated with the samples.

property url

A URL for this samples resource.