psnawp_api.models.trophies package#
Submodules#
psnawp_api.models.trophies.trophy module#
- class Trophy(trophy_set_version: str | None, has_trophy_groups: bool | None, total_items_count: int | None, trophy_id: int | None, trophy_hidden: bool | None, trophy_type: TrophyType | None, trophy_name: str | None, trophy_detail: str | None, trophy_icon_url: str | None, trophy_group_id: str | None, trophy_progress_target_value: int | None, trophy_reward_name: str | None, trophy_reward_img_url: str | None, earned: bool | None, progress: int | None, progress_rate: int | None, progressed_date_time: datetime | None, earned_date_time: datetime | None, trophy_rarity: TrophyRarity | None, trophy_earn_rate: float | None)[source]#
Bases:
object
A class that represents a PlayStation Video Game Trophy.
- total_items_count: int | None#
Total trophies in the group (or total trophies for the title if all specified)
True if this is a secret trophy (Only for client)
- trophy_type: TrophyType | None#
Type of the trophy
- progress: int | None#
If the trophy tracks progress towards unlock this is number of steps currently completed (ie. 73/300) (PS5 titles only)
- __init__(trophy_set_version: str | None, has_trophy_groups: bool | None, total_items_count: int | None, trophy_id: int | None, trophy_hidden: bool | None, trophy_type: TrophyType | None, trophy_name: str | None, trophy_detail: str | None, trophy_icon_url: str | None, trophy_group_id: str | None, trophy_progress_target_value: int | None, trophy_reward_name: str | None, trophy_reward_img_url: str | None, earned: bool | None, progress: int | None, progress_rate: int | None, progressed_date_time: datetime | None, earned_date_time: datetime | None, trophy_rarity: TrophyRarity | None, trophy_earn_rate: float | None) None #
Method generated by attrs for class Trophy.
- progress_rate: int | None#
If the trophy tracks progress towards unlock this is the current percentage complete (PS5 titles only)
- progressed_date_time: datetime | None#
If the trophy tracks progress towards unlock, and some progress has been made, then this returns the date progress was last updated. (PS5 titles only)
- trophy_rarity: TrophyRarity | None#
Rarity of the trophy
- class TrophyBuilder(request_builder: RequestBuilder, np_communication_id: str)[source]#
Bases:
object
Class for providing convenient methods to Build Trophy from PlayStation Endpoints
- __init__(request_builder: RequestBuilder, np_communication_id: str)[source]#
Constructor for class TrophyBuilder.
- Parameters:
request_builder (RequestBuilder) – The instance of RequestBuilder. Used to make HTTPRequests.
np_communication_id (str) – Unique ID of a game title used to request trophy information. This can be obtained from
GameTitle
class.
- game_trophies(platform: Literal['PS Vita', 'PS3', 'PS4', 'PS5'], trophy_group_id: str, limit: int | None) Iterator[Trophy] [source]#
Retrieves the individual trophy detail of a single - or all - trophy groups for a title.
- Parameters:
platform (Literal) – The platform this title belongs to.
trophy_group_id (str) – 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 (Optional[int]) – Limit of trophies returned, None means to return all trophy titles.
- Returns:
Returns the Trophy Generator object with all the information
- Return type:
Iterator[Trophy]
- Raises:
PSNAWPNotFound
if you don’t have any trophies for that game.
- earned_game_trophies(account_id: str, platform: Literal['PS Vita', 'PS3', 'PS4', 'PS5'], trophy_group_id: str, limit: int | None) Iterator[Trophy] [source]#
Retrieves the earned status individual trophy detail of a single - or all - trophy groups for a title.
- Parameters:
account_id (str) – The account whose trophy list is being accessed.
platform (Literal) – The platform this title belongs to.
trophy_group_id (str) – 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 (Optional[int]) – Limit of trophies returned, None means to return all trophy titles.
- Returns:
Returns the Trophy Generator object with all the information
- Return type:
Iterator[Trophy]
- Raises:
PSNAWPNotFound
if you don’t have any trophies for that game.- Raises:
PSNAWPForbidden
If the user’s profile is private
- earned_game_trophies_with_metadata(account_id: str, platform: Literal['PS Vita', 'PS3', 'PS4', 'PS5'], trophy_group_id: str, limit: int | None) Iterator[Trophy] [source]#
Retrieves the earned status with metadata of individual trophy detail of a single - or all - trophy groups for a title.
- Parameters:
account_id (str) – The account whose trophy list is being accessed.
platform (Literal) – The platform this title belongs to.
trophy_group_id (str) – 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 (Optional[int]) – Limit of trophies returned, None means to return all trophy titles.
- Returns:
Returns the Trophy Generator object with all the information
- Return type:
Iterator[Trophy]
- Raises:
PSNAWPNotFound
if you don’t have any trophies for that game.- Raises:
PSNAWPForbidden
If the user’s profile is private
psnawp_api.models.trophies.trophy_constants module#
- class TrophyType(value)[source]#
Bases:
Enum
An enumeration.
- BRONZE = 'bronze'#
- SILVER = 'silver'#
- GOLD = 'gold'#
- PLATINUM = 'platinum'#
- class PlatformType(value)[source]#
Bases:
Enum
An enumeration.
- UNKNOWN = 'UNKNOWN'#
- PS_VITA = 'PSVITA'#
- PS3 = 'PS3'#
- PS4 = 'PS4'#
- PS5 = 'PS5'#
psnawp_api.models.trophies.trophy_group module#
- class TrophyGroupSummary(trophy_group_id: str | None, trophy_group_name: str | None, trophy_group_detail: str | None, trophy_group_icon_url: str | None, defined_trophies: TrophySet, progress: int | None, earned_trophies: TrophySet, last_updated_datetime: str | None)[source]#
Bases:
object
TrophyGroupSummary contains trophy count data for one trophy group of a game title.
- trophy_group_id: str | None#
ID for the trophy group (all titles have default, additional groups are 001 incrementing)
- __init__(trophy_group_id: str | None, trophy_group_name: str | None, trophy_group_detail: str | None, trophy_group_icon_url: str | None, defined_trophies: TrophySet, progress: int | None, earned_trophies: TrophySet, last_updated_datetime: str | None) None #
Method generated by attrs for class TrophyGroupSummary.
- class TrophyGroupsSummary(trophy_set_version: str | None, trophy_title_name: str | None, trophy_title_detail: str | None, trophy_title_icon_url: str | None, trophy_title_platform: frozenset[psnawp_api.models.trophies.trophy_constants.PlatformType], defined_trophies: TrophySet, trophy_groups: list[psnawp_api.models.trophies.trophy_group.TrophyGroupSummary], hidden_flag: bool | None, progress: int | None, earned_trophies: TrophySet, last_updated_date_time: str | None)[source]#
Bases:
object
TrophyGroupsSummary contains trophy count data for all the groups in a game title combined and individual.
- trophy_title_platform: frozenset[psnawp_api.models.trophies.trophy_constants.PlatformType]#
The platform this title belongs to
- __init__(trophy_set_version: str | None, trophy_title_name: str | None, trophy_title_detail: str | None, trophy_title_icon_url: str | None, trophy_title_platform: frozenset[psnawp_api.models.trophies.trophy_constants.PlatformType], defined_trophies: TrophySet, trophy_groups: list[psnawp_api.models.trophies.trophy_group.TrophyGroupSummary], hidden_flag: bool | None, progress: int | None, earned_trophies: TrophySet, last_updated_date_time: str | None) None #
Method generated by attrs for class TrophyGroupsSummary.
- trophy_groups: list[psnawp_api.models.trophies.trophy_group.TrophyGroupSummary]#
Individual object for each trophy group returned
Whether title has been hidden on the accounts trophy list (Authenticating account only)
- class TrophyGroupsSummaryBuilder(request_builder: RequestBuilder, np_communication_id: str)[source]#
Bases:
object
Class for providing convenient method to Build TrophyGroupsSummary from PlayStation Endpoints
- __init__(request_builder: RequestBuilder, np_communication_id: str)[source]#
- Parameters:
request_builder (RequestBuilder) – The instance of RequestBuilder. Used to make HTTPRequests.
np_communication_id (str) – Unique ID of a game title used to request trophy information. This can be obtained from
GameTitle
class.
- game_title_trophy_groups_summary(platform: Literal['PS Vita', 'PS3', 'PS4', 'PS5']) TrophyGroupsSummary [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.
- Parameters:
platform (Literal) – The platform this title belongs to.
- Returns:
TrophyGroupSummary object containing title and title groups trophy information.
- Return type:
- Raises:
PSNAWPNotFound
if you don’t have any trophies for that game.- Raises:
PSNAWPForbidden
If the user’s profile is private
- user_trophy_groups_summary(account_id: str, platform: Literal['PS Vita', 'PS3', 'PS4', 'PS5']) TrophyGroupsSummary [source]#
Retrieves the earned 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.
- Parameters:
account_id (str) – The account whose trophy list is being accessed
platform (Literal) – The platform this title belongs to.
- Returns:
TrophyGroupSummary object containing title and title groups trophy information.
- Return type:
- Raises:
PSNAWPNotFound
if you don’t have any trophies for that game.- Raises:
PSNAWPForbidden
If the user’s profile is private
- user_trophy_groups_summary_with_metadata(account_id: str, platform: Literal['PS Vita', 'PS3', 'PS4', 'PS5']) TrophyGroupsSummary [source]#
Retrieves the earned trophy groups for a title and their respective trophy count along with metadata.
This is most commonly seen in games which have expansions where additional trophies are added.
- Parameters:
account_id (str) – The account whose trophy list is being accessed
platform (Literal) – The platform this title belongs to.
- Returns:
TrophyGroupSummary object containing title and title groups trophy information.
- Return type:
- Raises:
PSNAWPNotFound
if you don’t have any trophies for that game.- Raises:
PSNAWPForbidden
If the user’s profile is private
psnawp_api.models.trophies.trophy_summary module#
- class TrophySummary(account_id: str, trophy_level: int, progress: int, tier: int, earned_trophies: TrophySet)[source]#
Bases:
object
Class representing the overall summary of the number of trophies earned by a user.
- __init__(account_id: str, trophy_level: int, progress: int, tier: int, earned_trophies: TrophySet) None #
Method generated by attrs for class TrophySummary.
- classmethod from_endpoint(request_builder: RequestBuilder, account_id: str) TrophySummary [source]#
Retrieve an overall summary of the number of trophies earned for a user broken down by
type
overall trophy level
progress towards the next level
current tier
- Returns:
TrophySummary object with all the information
- Return type:
- Raises:
PSNAWPForbidden
If the user’s profile is private
psnawp_api.models.trophies.trophy_titles module#
- class TrophyTitle(total_items_count: int | None, np_service_name: str | None, np_communication_id: str | None, trophy_set_version: str | None, title_name: str | None, title_detail: str | None, title_icon_url: str | None, title_platform: frozenset[psnawp_api.models.trophies.trophy_constants.PlatformType], has_trophy_groups: bool | None, progress: int | None, hidden_flag: bool | None, earned_trophies: TrophySet, defined_trophies: TrophySet, last_updated_date_time: str | None, np_title_id: str | None, rarest_trophies: list[psnawp_api.models.trophies.trophy.Trophy] = _Nothing.NOTHING)[source]#
Bases:
object
A class containing summary of trophy data for a user for a game title
- np_service_name: str | None#
trophy for PS3, PS4, or PS Vita platforms and trophy2 for the PS5 platform
- title_platform: frozenset[psnawp_api.models.trophies.trophy_constants.PlatformType]#
Platforms this title belongs to
- has_trophy_groups: bool | None#
True if the title has multiple groups of trophies (eg. DLC trophies which are separate from the main trophy list)
Title has been hidden on the accounts trophy list (Only for Client)
- __init__(total_items_count: int | None, np_service_name: str | None, np_communication_id: str | None, trophy_set_version: str | None, title_name: str | None, title_detail: str | None, title_icon_url: str | None, title_platform: frozenset[psnawp_api.models.trophies.trophy_constants.PlatformType], has_trophy_groups: bool | None, progress: int | None, hidden_flag: bool | None, earned_trophies: TrophySet, defined_trophies: TrophySet, last_updated_date_time: str | None, np_title_id: str | None, rarest_trophies: list[psnawp_api.models.trophies.trophy.Trophy] = _Nothing.NOTHING) None #
Method generated by attrs for class TrophyTitle.
- last_updated_date_time: datetime | None#
00 TimeZone)
- Type:
Date most recent trophy earned for the title (UTC+00
- rarest_trophies: list[psnawp_api.models.trophies.trophy.Trophy]#
Returns the trophy where earned is true with the lowest trophyEarnedRate
- class TrophyTitles(request_builder: RequestBuilder, account_id: str)[source]#
Bases:
object
Retrieve all game titles associated with an account, and a summary of trophies earned from them.
- __init__(request_builder: RequestBuilder, account_id: str)[source]#
Constructor of TrophyTitles class.
Note
This class is intended to be interfaced with through PSNAWP.
- Parameters:
request_builder (RequestBuilder) – The instance of RequestBuilder. Used to make HTTPRequests.
account_id (str) – The account whose trophy list is being accessed
- get_trophy_titles(limit: int | None) Iterator[TrophyTitle] [source]#
Retrieve all game titles associated with an account, and a summary of trophies earned from them.
- Parameters:
limit (Optional[int]) – Limit of titles returned, None means to return all trophy titles.
- Returns:
Generator object with TitleTrophySummary objects
- Return type:
Iterator[TrophyTitle]
- Raises:
PSNAWPForbidden
If the user’s profile is private
- get_trophy_summary_for_title(title_ids: list[str]) Iterator[TrophyTitle] [source]#
Retrieve a summary of the trophies earned by a user for specific titles.
- Parameters:
- Returns:
Generator object with TitleTrophySummary objects
- Return type:
Iterator[TrophyTitle]
- Raises:
PSNAWPForbidden
If the user’s profile is private
- static get_np_communication_id(request_builder: RequestBuilder, title_id: str, account_id: str) str [source]#
Returns the np communication id of title. This is required for requesting detail about a titles trophies.
Note
The endpoint only returns useful response back if the account has played that particular video game.
- Parameters:
request_builder (RequestBuilder) – The instance of RequestBuilder. Used to make HTTPRequests.
title_id (str) – Unique ID of the title
account_id (str) – Account ID of the user.
- Returns:
np communication id of title
- Return type:
- Raises:
PSNAWPNotFound
If the user does not have any trophies for that game or the game doesn’t exist.