psnawp_api.models.game_title module#
Provides GameTitle class for retrieving Game details and trophies.
- class GameTitle(authenticator: Authenticator, title_id: str, platform: PlatformType, np_communication_id: str)[source]#
Bases:
objectThe GameTitle class provides the information and methods for retrieving Game details and trophies.
Used for fetching game details and trophies for title that client doesn’t own.
- Variables:
authenticator (Authenticator) – An instance of
Authenticatorused to authenticate and make HTTPS requests.title_id (str) – Unique identifier for the game, used across PSN services except for trophy data, which requires the np_communication_id. However, the title_id is used to fetch the np_communication_id.
platform (PlatformType) – The platform this title belongs to.
np_communication_id (str) – Unique identifier associated with a game’s trophy set, essential for accessing trophy data.
Note
This class is intended to be used via PSNAWP. See
psnawp_api.psnawp.PSNAWP.game_title().The GameTitle class constructor.
- Parameters:
authenticator – The Authenticator instance used for making authenticated requests to the API.
title_id – unique id of game.
platform – The platform this title belongs to.
np_communication_id – Unique ID of a game title used to request trophy information.
- HMAC_SHA1_KEY: ClassVar[bytes] = b'\xf5\xdef\xd2h\x0e%[-\xf7\x9et\xf8\x90\xeb\xf3I&/a\x8b\xca\xe2\xa9\xac\xcd\xeeQV\xce\x8d\xf2\xcd\xf2\xd4\x8cq\x17<\xdc%\x94F[\x87@]\x19|\xf1\xae\xd3\xb7\xe9g\x1e\xebV\xcagS\xc2\xe6\xb0'#
- __init__(authenticator: Authenticator, title_id: str, platform: PlatformType, np_communication_id: str) None[source]#
The GameTitle class constructor.
- Parameters:
authenticator – The Authenticator instance used for making authenticated requests to the API.
title_id – unique id of game.
platform – The platform this title belongs to.
np_communication_id – Unique ID of a game title used to request trophy information.
- classmethod from_title_id(authenticator: Authenticator, title_id: str, platform: PlatformType, account_id: str) Self[source]#
Initialize instance of GameTitle class from just the title_id.
During the construction of the object, an additional call is made to get the
np_communication_id. This ID is important for getting trophy data. You can avoid this additional HTTP request by using thewith_np_communication_id()class method.- Parameters:
authenticator – The Authenticator instance used for making authenticated requests to the API.
title_id – unique id of game.
platform – The platform this title belongs to.
- Returns:
Instance of
GameTitle- Raises:
PSNAWPNotFoundError – If the user does not have any trophies for that game or the game doesn’t exist.
- get_details(country: str | None = None, language: str | None = None) list[dict[str, Any]][source]#
Get game details such as full name, description, genre, promotional videos/images, etc…
If country or language is not provided, defaults will be used from the authenticator headers.
- Parameters:
country – The country code used to retrieve localized content, in ISO 3166-1 alpha-2 format (e.g., “US”, “JP”).
language – The language code used to retrieve localized content, using the IETF BCP 47 format (e.g., “en-US”, “fr-FR”).
- Returns:
A list of dicts containing info similar to what is shown below (Not all values are shown because of space limitations):
[ { "id": 201930, "name": "Grand Theft Auto V (PlayStation®5)", "nameEn": "Grand Theft Auto V (PlayStation®5)", "publisherName": "Rockstar Games", "media": { }, "descriptions": [], "categorizedProducts": [], "titleIds": [], "country": "US", "language": "en", "type": "GAME", "localizedName": {}, "localizedDescriptions": {}, "localizedPublisherName": {}, "defaultProduct": {}, "genres": [], "localizedGenres": [], "subGenres": [], "localizedSubGenres": [], "minimumAge": 17, "releaseDate": {}, "isRecommendableOnStore": true, "isSearchableOnStore": true, "storeFronts": [], "supportedStoreFronts": [], "marketingStories": [], "compatibilityNotices": [], "localizedMedia": {}, "revisionIds": {}, "contentRating": {} } ]
- get_title_icon_url() str[source]#
Generate/retrieve the title icon URL for a PlayStation 3/4 title.
- Returns:
the title icon URL
- Raises:
PSNAWPIllegalArgumentError – If the platform is not supported.
- trophies(trophy_group_id: str = 'default', limit: int | None = None, offset: int = 0, page_size: int = 200) TrophyIterator[source]#
Retrieves the individual trophy detail of a single - or all - trophy groups for a title.
- Parameters:
trophy_group_id – ID for the trophy group. Each game expansion is represented by a separate ID. all to return all trophies for the title, default for the game itself, and additional groups starting from 001 and so on return expansions trophies.
limit – Limit of trophies returned, None means to return all trophy titles.
offset – The starting point within the collection of trophies.
page_size – The number of trophies to return per page.
- Returns:
Returns the Trophy Generator object with all the information
- Raises:
PSNAWPNotFoundError – If you don’t have any trophies for that game.
- trophy_groups_summary() TrophyGroupsSummary[TrophyGroupSummary][source]#
Retrieves the trophy groups for a title and their respective trophy count.
This is most commonly seen in games which have expansions where additional trophies are added.
- Returns:
TrophyGroupSummary object containing title and title groups trophy information.
- Raises:
PSNAWPNotFoundError – If you don’t have any trophies for that game.
- classmethod with_np_communication_id(authenticator: Authenticator, title_id: str, platform: PlatformType, np_communication_id: str) Self[source]#
Initialize instance of GameTitle class with
np_communication_idprovided.- Parameters:
authenticator – The Authenticator instance used for making authenticated requests to the API.
title_id – unique id of game.
platform – The platform this title belongs to.
np_communication_id – Unique ID of a game title used to request trophy information.
- Returns:
Instance of
GameTitle