psnawp_api.models.trophies.trophy module#
Defines the Trophy class and methods to access individual trophies within a trophy group, such as those from the main game or DLCs.
- class Trophy(trophy_set_version: str | None, has_trophy_groups: bool | 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)[source]#
Bases:
objectA class that represents a PlayStation Video Game Trophy.
- Variables:
trophy_set_version (str | None) – The current version of the trophy set.
has_trophy_groups (bool | None) – True if this title has additional trophy groups.
trophy_id (int | None) – Unique ID for this trophy.
trophy_hidden (bool | None) – True if this is a secret trophy (Only for client).
trophy_type (TrophyType | None) – Type of the trophy.
trophy_name (str | None) – Name of trophy.
trophy_detail (str | None) – Description of the trophy.
trophy_icon_url (str | None) – URL for the graphic associated with the trophy.
trophy_group_id (str | None) – ID of the trophy group this trophy belongs to.
trophy_progress_target_value (int | None) – Trophy progress towards it being unlocked (PS5 Only).
trophy_reward_name (str | None) – Name of the reward earning the trophy grants (PS5 Only).
trophy_reward_img_url (str | None) – URL for the graphic associated with the reward (PS5 Only).
To initialize this class, you need the
Trophy.from_trophy_dict().- __init__(trophy_set_version: str | None, has_trophy_groups: bool | 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) None#
- classmethod from_trophy_dict(trophy_dict: dict[str, Any]) Self[source]#
Creates an instance of
Trophyfrom a dictionary.
- trophy_type: TrophyType | None#
- class TrophyIterator(authenticator: Authenticator, url: str, pagination_args: PaginationArguments, platform: PlatformType)[source]#
Bases:
PaginationIterator[Trophy]Class for Iterating over all trophies for a specified group within a game title.
To initialize this class, you need the
TrophyIterator.from_endpoint()Note
This class is intended to be used via Client or User class. See
psnawp_api.models.client.Client.trophies()orpsnawp_api.models.user.User.trophies().Init for TrophyIterator.
- __init__(authenticator: Authenticator, url: str, pagination_args: PaginationArguments, platform: PlatformType) None[source]#
Init for TrophyIterator.
- fetch_next_page() Generator[Trophy, None, None][source]#
Fetches the next page in endpoint with pagination.
- classmethod from_endpoint(authenticator: Authenticator, pagination_args: PaginationArguments, np_communication_id: str, platform: PlatformType, trophy_group_id: str) Self[source]#
Creates an instance of
TrophyIteratorfrom api endpoint.
- class TrophyWithProgress(trophy_set_version: str | None, has_trophy_groups: bool | 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:
TrophyEarned Trophy Info.
- Variables:
earned (bool | None) – True if this trophy has been earned.
progress (int | None) – If the trophy tracks progress towards unlock this is number of steps currently completed (ie. 73/300) (PS5 titles only).
progress_rate (int | None) – If the trophy tracks progress towards unlock this is the current percentage complete (PS5 titles only).
progressed_date_time (datetime.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).
earned_date_time (datetime.datetime | None) – Date trophy was earned.
trophy_rarity (TrophyRarity | None) – Rarity of the trophy.
trophy_earn_rate (float | None) – Percentage of all users who have earned the trophy.
To initialize this class, you need the
TrophyWithProgress.from_trophy_dict().- __init__(trophy_set_version: str | None, has_trophy_groups: bool | 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#
- classmethod from_trophies_list(trophies_dict: list[dict[str, Any]] | None) list[Trophy][source]#
Creates an list of
TrophyWithProgressfrom list of dictionaries.
- classmethod from_trophy_dict(trophy_dict: dict[str, Any]) Self[source]#
Creates an instance of
TrophyWithProgressfrom a dictionary.
- trophy_rarity: TrophyRarity | None#
- class TrophyWithProgressIterator(authenticator: Authenticator, url: str, pagination_args: PaginationArguments, platform: PlatformType, progress_url: str)[source]#
Bases:
PaginationIterator[TrophyWithProgress]Class for Iterating over all trophies for a specified group within a game title, this class includes user progress for each trophy.
To initialize this class, you need the
TrophyWithProgressIterator.from_endpoint().Warning
Retrieving the progress of Trophies will require double the number of request because the progress has to be fetched via separate endpoint.
Note
This class is intended to be used via Client or User class. See
psnawp_api.models.client.Client.trophies()orpsnawp_api.models.user.User.trophies().Init for TrophyWithProgressIterator.
- __init__(authenticator: Authenticator, url: str, pagination_args: PaginationArguments, platform: PlatformType, progress_url: str) None[source]#
Init for TrophyWithProgressIterator.
- fetch_next_page() Generator[TrophyWithProgress, None, None][source]#
Fetches the next page in endpoint with pagination.
- classmethod from_endpoint(authenticator: Authenticator, pagination_args: PaginationArguments, np_communication_id: str, platform: PlatformType, trophy_group_id: str, account_id: str) Self[source]#
Fetches the next page in endpoint with pagination.
- rarest_trophies: list[RarestTrophies] | None#