clients

Clients for the main resources of the GiantBomb API.

http://www.giantbomb.com/api/documentation#toc-0-1

games_client

Client for the Games resource of GiantBomb.

https://www.giantbomb.com/api/documentation#toc-0-17

class pybomb.clients.games_client.GamesClient(api_key)

Bases: pybomb.clients.base.search_client.SearchClient

Client for the ‘games’ API resource.

RESOURCE_NAME = 'games'
RESPONSE_FIELD_MAP: Dict[str, pybomb.clients.base.client.ResponseParam] = {'aliases': ResponseParam(is_filter=True, is_sort=False), 'api_detail_url': ResponseParam(is_filter=False, is_sort=False), 'date_added': ResponseParam(is_filter=True, is_sort=True), 'date_last_updated': ResponseParam(is_filter=True, is_sort=True), 'deck': ResponseParam(is_filter=False, is_sort=False), 'description': ResponseParam(is_filter=False, is_sort=False), 'expected_release_month': ResponseParam(is_filter=True, is_sort=False), 'expected_release_quarter': ResponseParam(is_filter=True, is_sort=False), 'expected_release_year': ResponseParam(is_filter=True, is_sort=False), 'id': ResponseParam(is_filter=True, is_sort=True), 'image': ResponseParam(is_filter=False, is_sort=False), 'name': ResponseParam(is_filter=True, is_sort=True), 'number_of_user_reviews': ResponseParam(is_filter=True, is_sort=True), 'original_game_rating': ResponseParam(is_filter=False, is_sort=True), 'original_release_date': ResponseParam(is_filter=True, is_sort=True), 'platforms': ResponseParam(is_filter=True, is_sort=False), 'site_detail_url': ResponseParam(is_filter=False, is_sort=False)}

Search with a simplier API.

This method allows you to search for a game using only the title and the platform.

Parameters
  • name (str) – The name of the game to search for

  • platform (Optional[int]) – The platform ID that the game is required to have. When set to None no platform filters will be added. Defaults to None

  • sort_by (Optional[str]) – The field to sort the items in the reponse by. These will be validated against the availiable sort fields.

  • desc (bool) – If sort direction is DESC or not (ASC). Defaults to True

  • args (Any) – Additional arguments.

  • kwargs (Any) – Additional keyword arguments.

Return type

Response

Returns

A PyBomb Response containg the results of the search

game_client

Client for the Game resource of GiantBomb.

https://www.giantbomb.com/api/documentation#toc-0-16

class pybomb.clients.game_client.GameClient(api_key)

Bases: pybomb.clients.base.fetch_client.FetchClient

Client for the ‘game’ API resource.

RESOURCE_NAME = 'game'
RESPONSE_FIELD_MAP: Dict[str, pybomb.clients.base.client.ResponseParam] = {'aliases': ResponseParam(is_filter=True, is_sort=False), 'api_detail_url': ResponseParam(is_filter=True, is_sort=False), 'characters': ResponseParam(is_filter=True, is_sort=False), 'concepts': ResponseParam(is_filter=True, is_sort=False), 'date_added': ResponseParam(is_filter=True, is_sort=False), 'date_last_updated': ResponseParam(is_filter=True, is_sort=False), 'deck': ResponseParam(is_filter=True, is_sort=False), 'description': ResponseParam(is_filter=True, is_sort=False), 'developers': ResponseParam(is_filter=True, is_sort=False), 'expected_release_day': ResponseParam(is_filter=True, is_sort=False), 'expected_release_month': ResponseParam(is_filter=True, is_sort=False), 'expected_release_quarter': ResponseParam(is_filter=True, is_sort=False), 'expected_release_year': ResponseParam(is_filter=True, is_sort=False), 'first_appearance_characters': ResponseParam(is_filter=True, is_sort=False), 'first_appearance_concepts': ResponseParam(is_filter=True, is_sort=False), 'first_appearance_locations': ResponseParam(is_filter=True, is_sort=False), 'first_appearance_objects': ResponseParam(is_filter=True, is_sort=False), 'first_appearance_people': ResponseParam(is_filter=True, is_sort=False), 'franchises': ResponseParam(is_filter=True, is_sort=False), 'genres': ResponseParam(is_filter=True, is_sort=False), 'id': ResponseParam(is_filter=True, is_sort=False), 'image': ResponseParam(is_filter=True, is_sort=False), 'images': ResponseParam(is_filter=True, is_sort=False), 'killed_characters': ResponseParam(is_filter=True, is_sort=False), 'locations': ResponseParam(is_filter=True, is_sort=False), 'name': ResponseParam(is_filter=True, is_sort=False), 'number_of_user_reviews': ResponseParam(is_filter=True, is_sort=False), 'objects': ResponseParam(is_filter=True, is_sort=False), 'original_game_rating': ResponseParam(is_filter=False, is_sort=True), 'original_release_date': ResponseParam(is_filter=True, is_sort=False), 'people': ResponseParam(is_filter=True, is_sort=False), 'platforms': ResponseParam(is_filter=True, is_sort=False), 'publishers': ResponseParam(is_filter=True, is_sort=False), 'releases': ResponseParam(is_filter=True, is_sort=False), 'reviews': ResponseParam(is_filter=True, is_sort=False), 'similar_games': ResponseParam(is_filter=True, is_sort=False), 'site_detail_url': ResponseParam(is_filter=True, is_sort=False), 'themes': ResponseParam(is_filter=True, is_sort=False), 'videos': ResponseParam(is_filter=True, is_sort=False)}
fetch(id_, return_fields=None)

Fetch details of a game by ID.

Parameters
  • id – The ID of the game

  • return_fields (Optional[List]) – A list of fields to be returned by the response. These will be validated against the availiable return fields. The default is to return everything

Return type

Response

Returns

A Pybomb Respose object containing the details of the requested game

platforms_client

Client for the Platforms resource of GiantBomb.

https://www.giantbomb.com/api/documentation#toc-0-30

class pybomb.clients.platforms_client.PlatformsClient(api_key)

Bases: pybomb.clients.base.search_client.SearchClient

Client for the ‘platforms’ API resource.

RESOURCE_NAME = 'platforms'
RESPONSE_FIELD_MAP: Dict[str, pybomb.clients.base.client.ResponseParam] = {'abbreviation': ResponseParam(is_filter=True, is_sort=True), 'api_detail_url': ResponseParam(is_filter=False, is_sort=False), 'company': ResponseParam(is_filter=True, is_sort=False), 'date_added': ResponseParam(is_filter=True, is_sort=True), 'date_last_updated': ResponseParam(is_filter=True, is_sort=True), 'deck': ResponseParam(is_filter=False, is_sort=False), 'description': ResponseParam(is_filter=False, is_sort=False), 'guid': ResponseParam(is_filter=False, is_sort=False), 'id': ResponseParam(is_filter=True, is_sort=True), 'image': ResponseParam(is_filter=False, is_sort=False), 'image_tags': ResponseParam(is_filter=False, is_sort=False), 'install_base': ResponseParam(is_filter=True, is_sort=True), 'name': ResponseParam(is_filter=True, is_sort=True), 'online_support': ResponseParam(is_filter=True, is_sort=True), 'original_price': ResponseParam(is_filter=True, is_sort=True), 'release_date': ResponseParam(is_filter=True, is_sort=True), 'site_detail_url': ResponseParam(is_filter=False, is_sort=False)}

Search with a simplier API.

This method allows you to search for a platform using only the name.

Parameters
  • name (str) – The name of the platform to search for

  • sort_by (Optional[str]) – The field to sort the items in the reponse by. These will be validated against the availiable sort fields.

  • desc (bool) – If sort direction is DESC or not (ASC). Defaults to True

  • args (Any) – Additional arguments.

  • kwargs (Any) – Additional keyword arguments.

Return type

Response

Returns

A PyBomb Response containg the results of the search

base

Base Clients module for base clients used to create GB API clients.

client

Base client used by fetch and search clients.

class pybomb.clients.base.client.Client(api_key)

Bases: abc.ABC

Base class for GB API resource clients.

RESOURCE_NAME = ''
RESPONSE_FIELD_MAP: Dict[str, pybomb.clients.base.client.ResponseParam] = {}
RESPONSE_FORMAT_JSON = 'json'
RESPONSE_STATUS_OK = 1
SORT_ORDER_ASCENDING = 'asc'
SORT_ORDER_DESCENDING = 'desc'
URI_BASE = 'http://www.giantbomb.com/api/'
class pybomb.clients.base.client.ResponseParam(is_filter: bool, is_sort: bool)

Bases: tuple

Control structure for marking fields as filter-able and sort-able.

property is_filter

Alias for field number 0

property is_sort

Alias for field number 1

fetch_client

Base client to extend to create fetch clients for endpoints of the GiantBomb API.

class pybomb.clients.base.fetch_client.FetchClient(api_key)

Bases: pybomb.clients.base.client.Client

Base class for fetch GB API resource clients.

abstract fetch(id_, return_fields=None)

Fetch details of a game by ID.

Return type

Response

search_client

Base client to extend to create search clients for endpoints of the GiantBomb API.

class pybomb.clients.base.search_client.SearchClient(api_key)

Bases: pybomb.clients.base.client.Client

Base class for search GB API resource clients.

Search with a simplier API.

Return type

Response

search(filter_by, return_fields=None, sort_by=None, desc=True, limit=None, offset=None)

Full search of resource.

Supports all search fields available in API http://www.giantbomb.com/api/documentation

Parameters
  • filter_by (Dict[str, Any]) – A map of fields to filter the search by. These will be validated against the availiable search fields

  • return_fields (Optional[List]) – A list of fields to be returned by the response. These will be validated against the availiable return fields. The default is to return everything

  • sort_by (Optional[str]) – The field to sort the items in the reponse by. These will be validated against the availiable sort fields.

  • desc (bool) – If sort direction is DESC or not (ASC). Defaults to True

  • limit (Optional[int]) – The max number of items to request

  • offset (Optional[int]) – The start offset for the return items, based on the given sort.

Return type

Response

Returns

A PyBomb Response containing the results of the search