psnawp_api.models package#
Subpackages#
- psnawp_api.models.listing package
- psnawp_api.models.trophies package
- Submodules
- psnawp_api.models.trophies.trophy module
Trophy
Trophy.trophy_set_version
Trophy.has_trophy_groups
Trophy.total_items_count
Trophy.trophy_id
Trophy.trophy_hidden
Trophy.trophy_type
Trophy.trophy_name
Trophy.trophy_detail
Trophy.trophy_icon_url
Trophy.trophy_group_id
Trophy.trophy_progress_target_value
Trophy.trophy_reward_name
Trophy.trophy_reward_img_url
Trophy.earned
Trophy.progress
Trophy.__init__()
Trophy.progress_rate
Trophy.progressed_date_time
Trophy.earned_date_time
Trophy.trophy_rarity
Trophy.trophy_earn_rate
Trophy.from_trophy_dict()
Trophy.from_trophies_list()
TrophyBuilder
- psnawp_api.models.trophies.trophy_constants module
- psnawp_api.models.trophies.trophy_group module
TrophyGroupSummary
TrophyGroupSummary.trophy_group_id
TrophyGroupSummary.trophy_group_name
TrophyGroupSummary.trophy_group_detail
TrophyGroupSummary.trophy_group_icon_url
TrophyGroupSummary.defined_trophies
TrophyGroupSummary.progress
TrophyGroupSummary.earned_trophies
TrophyGroupSummary.last_updated_datetime
TrophyGroupSummary.__init__()
TrophyGroupsSummary
TrophyGroupsSummary.trophy_set_version
TrophyGroupsSummary.trophy_title_name
TrophyGroupsSummary.trophy_title_detail
TrophyGroupsSummary.trophy_title_icon_url
TrophyGroupsSummary.trophy_title_platform
TrophyGroupsSummary.defined_trophies
TrophyGroupsSummary.__init__()
TrophyGroupsSummary.trophy_groups
TrophyGroupsSummary.hidden_flag
TrophyGroupsSummary.progress
TrophyGroupsSummary.earned_trophies
TrophyGroupsSummary.last_updated_date_time
TrophyGroupsSummaryBuilder
- psnawp_api.models.trophies.trophy_summary module
- psnawp_api.models.trophies.trophy_titles module
TrophyTitle
TrophyTitle.total_items_count
TrophyTitle.np_service_name
TrophyTitle.np_communication_id
TrophyTitle.trophy_set_version
TrophyTitle.title_name
TrophyTitle.title_detail
TrophyTitle.title_icon_url
TrophyTitle.title_platform
TrophyTitle.has_trophy_groups
TrophyTitle.progress
TrophyTitle.hidden_flag
TrophyTitle.earned_trophies
TrophyTitle.__init__()
TrophyTitle.defined_trophies
TrophyTitle.last_updated_date_time
TrophyTitle.np_title_id
TrophyTitle.rarest_trophies
TrophyTitles
- psnawp_api.models.trophies.utility_functions module
- Module contents
Submodules#
psnawp_api.models.client module#
- class Client(request_builder: RequestBuilder)[source]#
Bases:
object
The Client class provides the information and methods for the currently authenticated user.
- __init__(request_builder: RequestBuilder)[source]#
Initialize a Client instance.
Note
This class is intended to be interfaced with through PSNAWP.
- Parameters:
request_builder (RequestBuilder) – The instance of RequestBuilder. Used to make HTTPRequests.
- property online_id: str#
Gets the online ID of the client logged in the api.
- Returns:
onlineID
- Return type:
client = psnawp.me() print(client.online_id)
- property account_id: str#
Gets the account ID of the client logged in the api.
- Returns:
accountID
- Return type:
client = psnawp.me() print(client.account_id)
- get_profile_legacy() dict[str, Any] [source]#
Gets the profile info from legacy api endpoint. Useful for legacy console (PS3, PS4) presence.
- Returns:
A dict containing info similar to what is shown below:
- Return type:
dict[str, Any]
{ "profile": { "onlineId": "VaultTec_Trading", "accountId": "8520698476712646544", "npId": "VmF1bHRUZWNfVHJhZGluZ0BiNi51cw==", "avatarUrls": [ { "size": "l", "avatarUrl": "[Redacted]" } ], "plus": 0, "aboutMe": "r/Fallout76Marketplace Moderator", "languagesUsed": [ "en" ], "trophySummary": { "level": 1, "progress": 0, "earnedTrophies": { "platinum": 0, "gold": 0, "silver": 0, "bronze": 0 } }, "isOfficiallyVerified": false, "personalDetail": { "firstName": "VaultTec", "lastName": "TradingCo", "profilePictureUrls": [ { "size": "xl", "profilePictureUrl": "[Redacted]" } ] }, "personalDetailSharing": "no", "personalDetailSharingRequestMessageFlag": false, "primaryOnlineStatus": "offline", "presences": [ { "onlineStatus": "offline", "hasBroadcastData": false, "lastOnlineDate": "2021-02-05T20:14:45Z" } ], "friendRelation": "no", "requestMessageFlag": false, "blocking": false, "following": false, "consoleAvailability": { "availabilityStatus": "offline" } } }
client = psnawp.me() print(client.get_profile_legacy())
- get_account_devices() list[dict[str, Any]] [source]#
Gets the list of devices the client is logged into.
- Returns:
A dict containing info similar to what is shown below:
- Return type:
list[dict[str, Any]]
[ { "deviceId": "[Redacted]", "deviceType": "PS4", "activationType": "PSN_GAME_V3", "activationDate": "2021-02-05T20:11:27.815Z", "accountDeviceVector": "[Redacted]" } ]
client = psnawp.me() print(client.get_account_devices())
- friends_list(limit: int = 1000) Iterator[User] [source]#
Gets the friends list and return their account ids.
- Parameters:
limit (int) – The number of items from input max is 1000.
- Returns:
All friends in your friends list.
- Return type:
Iterator[User]
client = psnawp.me() friends_list = client.friends_list() for friend in friends_list: ...
- available_to_play() Iterator[User] [source]#
Gets the list of users on your “Notify when available” subscription list.
- Returns:
Iterator of user objects.
- Return type:
Iterator[User]
client = psnawp.me() available_to_play = client.available_to_play() for user in available_to_play: ...
- blocked_list() Iterator[User] [source]#
Gets the blocked list and return their account ids.
- Returns:
Al blocked users on your block list.
- Return type:
Iterator[User]
client = psnawp.me() blocked_list = client.blocked_list() for blocked_users in blocked_list: ...
- get_groups(limit: int = 200, offset: int = 0) Iterator[Group] [source]#
Gets all the groups you have participated in.
- trophy_summary() 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:
Trophy Summary Object containing all information
- Return type:
client = psnawp.me() print(client.trophy_summary())
- trophy_titles(limit: int | None = 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]
client = psnawp.me() for trophy_title in client.trophy_titles(limit=None): print(trophy_title)
- trophy_titles_for_title(title_ids: list[str]) Iterator[TrophyTitle] [source]#
Retrieve a summary of the trophies earned by a user for specific titles.
Note
title_id
can be obtained from https://andshrew.github.io/PlayStation-Titles/ or frompsnawp_api.models.search.Search.get_title_id()
- Parameters:
- Returns:
Generator object with TitleTrophySummary objects
- Return type:
Iterator[TrophyTitle]
client = psnawp.me() for trophy_title in client.trophy_titles_for_title(title_ids=['CUSA00265_00']): print(trophy_title)
- trophies(np_communication_id: str, platform: Literal['PS Vita', 'PS3', 'PS4', 'PS5'], trophy_group_id: str = 'default', limit: int | None = None, include_metadata: bool = False) Iterator[Trophy] [source]#
Retrieves the earned status individual trophy detail of a single - or all - trophy groups for a title.
- Parameters:
np_communication_id (str) – Unique ID of a game title used to request trophy information. This can be obtained from
GameTitle
class.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.
include_metadata (bool) – If True, will fetch metadata for trophy such as name and detail
Warning
Setting
include_metadata
toTrue
will use twice the amount of rate limit since the API wrapper has to obtain metadata from a separate endpoint.- Returns:
Returns the Trophy Generator object with all the information
- Return type:
Iterator[Trophy]
- trophy_groups_summary(np_communication_id: str, platform: Literal['PS Vita', 'PS3', 'PS4', 'PS5'], include_metadata: bool = False) 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:
np_communication_id (str) – Unique ID of a game title used to request trophy information. This can be obtained from
GameTitle
class.platform (Literal) – The platform this title belongs to.
platform – The platform this title belongs to.
include_metadata (bool) – If True, will fetch results from another endpoint and include metadata for trophy group such as name and detail
Warning
Setting
include_metadata
toTrue
will use twice the amount of rate limit since the API wrapper has to obtain metadata from a separate endpoint.- Returns:
TrophyGroupSummary object containing title and title groups trophy information.
- Return type:
- title_stats(*, limit: int | None = None, offset: int = 0, page_size: int = 200) TitleStatsListing [source]#
Retrieve a list of titles with their stats and basic meta-data
- Parameters:
Warning
Only returns data for PS4 games and above.
- Returns:
Iterator class for TitleStats
- Return type:
Iterator[TitleStatsListing]
user_example = psnawp.client() titles = list(user_example.title_stats())
psnawp_api.models.game_title module#
- class GameTitle(request_builder: RequestBuilder, title_id: str, account_id: str, np_communication_id: str | None)[source]#
Bases:
object
The GameTitle class provides the information and methods for retrieving Game details and trophies.
Note
This class is only useful if the user has played that video game. See
psnawp_api.psnawp.PSNAWP.game_title()
for more information.- __init__(request_builder: RequestBuilder, title_id: str, account_id: str, np_communication_id: str | None)[source]#
The GameTitle class constructor.
Note
This class is intended to be interfaced with through PSNAWP.
Note
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.
Note
title_id
can be obtained from https://andshrew.github.io/PlayStation-Titles/ or frompsnawp_api.models.search.Search.get_title_id()
- Parameters:
request_builder (RequestBuilder) – The instance of RequestBuilder. Used to make HTTPRequests.
title_id (str) – unique id of game.
np_communication_id (Optional[str]) – Unique ID of a game title used to request trophy information.
- Param:
account_id: The account whose trophy list is being accessed
- Raises:
PSNAWPNotFound
If the user does not have any trophies for that game or the game doesn’t exist.
- get_details() list[dict[str, Any]] [source]#
Get game details such as full name, description, genre, promotional videos/images, etc…
- Returns:
A list of dicts containing info similar to what is shown below (Not all values are shown because of space limitations):
- Return type:
list[dict[str, Any]]
[ { "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": {} } ]
- trophies(platform: Literal['PS Vita', 'PS3', 'PS4', 'PS5'], trophy_group_id: str = 'default', limit: int | None = 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.
- 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.
psnawp_api.models.group module#
- class Group(request_builder: RequestBuilder, group_id: str | None, users: Iterator[User] | None)[source]#
Bases:
object
The Group class manages PSN group endpoints related to messages (Group and Direct Messages).
- __init__(request_builder: RequestBuilder, group_id: str | None, users: Iterator[User] | None)[source]#
Constructor of Group.
Note
This class is intended to be interfaced with through PSNAWP.
- Parameters:
request_builder (RequestBuilder) – The instance of RequestBuilder. Used to make HTTPRequests.
group_id (Optional[str]) – The Group ID of a group.
users (Optional[Iterator[User]]) – A list of users of the members in the group.
- Raises:
PSNAWPNotFound
If group id does not exist or is invalid.- Raises:
PSNAWPForbidden
If you are Dming a user who has blocked you. blocked you.
- change_name(group_name: str) None [source]#
Changes the group name to one specified in arguments.
Note
You cannot change the name of DM groups. i.e. Groups with only two people (including you).
- Parameters:
group_name (str) – The name of the group that will be set.
- Returns:
None
- Raises:
PSNAWPBadRequest
If you are not part of group or the group is a DM.
- get_group_information() dict[str, Any] [source]#
Gets the group chat information such as about me, avatars, languages etc…
- Returns:
A dict containing info similar to what is shown below:
- Return type:
- Raises:
PSNAWPNotFound
If group id does not exist or is invalid.
{ "groupId": "~25C4C5406FD6D50E.763F9A1EB6AB5790", "groupType": 0, "modifiedTimestamp": "1663911908531", "groupName": { "value": "", "status": 0 }, "groupIcon": { "status": 0 }, "joinedTimestamp": "1616356026000", "isFavorite": false, "existsNewArrival": false, "mainThread": { "threadId": "~25C4C5406FD6D50E.763F9A1EB6AB5790", "modifiedTimestamp": "1663911908531", "latestMessage": { "messageUid": "1#425961448584099", "messageType": 1, "alternativeMessageType": 1, "body": "Hello World", "createdTimestamp": "1663911908531", "sender": { "accountId": "8520698476712646544", "onlineId": "VaultTec_Trading" } }, "readMessageUid": "1#425961448584099" }, "members": [ { "accountId": "2721516955383551246", "onlineId": "VaultTec-Co" }, { "accountId": "8520698476712646544", "onlineId": "VaultTec_Trading" } ], "partySessions": [], "notificationSetting": { "isMute": false } }
- send_message(message: str) dict[str, str] [source]#
Sends a message in the group.
Note
For now only text based messaging is supported.
- Parameters:
message – Message Body
- Returns:
A dict containing info similar to what is shown below:
- Return type:
{ "messageUid": "1#425961448584099", "createdTimestamp": "1663911908531" }
- get_conversation(limit: int = 20) dict[str, Any] [source]#
Gets the conversations in a group.
- Parameters:
limit (int) – The number of conversations to receive.
- Returns:
A dict containing info similar to what is shown below:
- Return type:
dict[str, Any]
{ "messages": [ { "messageUid": "1#425961448584099", "messageType": 1, "alternativeMessageType": 1, "body": "Hello World", "createdTimestamp": "1663911908531", "sender": { "accountId": "8520698476712646544", "onlineId": "VaultTec_Trading" } } ], "previous": "1#425961448584099", "next": "1#425961448584099", "reachedEndOfPage": false, "messageCount": 1 }
psnawp_api.models.search module#
- class Search(request_builder: RequestBuilder)[source]#
Bases:
object
- __init__(request_builder: RequestBuilder)[source]#
The Search class provides the information and methods for searching resources on playstation network.
Note
This class is intended to be interfaced with through PSNAWP.
- Parameters:
request_builder (RequestBuilder) – The instance of RequestBuilder. Used to make HTTPRequests.
- universal_search(search_query: str, limit: int = 20) dict[str, Any] [source]#
Searches the Playstation Website. Note: It does not work as of now and the endpoints returns whole html page.
Note
Pagination not yet supported. The max number of results returned will be 20.
- Parameters:
- Returns:
A dict containing info similar to what is shown below (Not all values are shown because of space limitations):
- Return type:
dict[str, Any]
{ "prefix": "GTA", "suggestions": [], "domainResponses": [ { "domain": "ConceptGameMobileApp", "domainTitle": "Results for ConceptGameMobileApp with search term GTA", "domainTitleMessageId": "msgid_null", "domainTitleHighlight": [ "Results for ConceptGameMobileApp with search term GTA" ], "zeroState": false, "univexId": "search.no_experiment.non.0.non_", "facetOptions": [], "next": "", "totalResultCount": 33, "results": [ { "id": "201930:UP1004-CUSA00419_00-GTAVDIGITALDOWNL", "type": "conceptProduct", "univexId": "search.no_experiment.non.0.non_", "score": 234.40508, "conceptProductMetadata": {} } ] } ], "fallbackQueried": false }
- get_title_id(title_name: str) tuple[str, str] [source]#
Gets the title id from title name using universal search endpoint.
Warning
Make sure to use the official full name of the video game otherwise the returned results may not be accurate. For example: GTA V returns the GTA Vice City since the Vice City shows up above GTA V. However, Grand Theft Auto V returns the correct results.
psnawp_api.models.title_stats module#
- class PlatformCategory(value)[source]#
Bases:
Enum
An enumeration.
- UNKNOWN = 'unknown'#
- PS4 = 'ps4_game'#
- PS5 = 'ps5_native_game'#
- platform_str_to_enum(platform_type_str: str | None) PlatformCategory [source]#
- class TitleStats(title_id: str | None, name: str | None, image_url: str | None, category: PlatformCategory | None, play_count: int | None, first_played_date_time: datetime | None, last_played_date_time: datetime | None, play_duration: timedelta | None)[source]#
Bases:
object
A class that represents a PlayStation Video Game Play Time Stats.
- category: PlatformCategory | None#
Category/Platform Type
- classmethod from_endpoint(request_builder: RequestBuilder, account_id: str, limit: int | None) Iterator[TitleStats] [source]#
- class TitleStatsListing(request_builder: RequestBuilder, account_id: str, pagination_arguments: PaginationArguments)[source]#
Bases:
Iterator
[TitleStats
]Iterator for retrieving title statistics.
This iterator fetches title statistics for a given account ID with pagination support.
- Parameters:
request_builder (RequestBuilder) – The request builder instance.
account_id (str) – The ID of the account for which to retrieve title statistics.
pagination_arguments (PaginationArguments) – The pagination arguments for configuring the listing.
- Variables:
- Yields:
TitleStats: The title statistics for each iteration.
- Raises:
If the specified total limit is reached or all the data is exhausted.
- __init__(request_builder: RequestBuilder, account_id: str, pagination_arguments: PaginationArguments)[source]#
psnawp_api.models.user module#
- class User(request_builder: RequestBuilder, online_id: str, account_id: str)[source]#
Bases:
object
This class will contain the information about the PSN ID you passed in when creating object
- classmethod from_online_id(request_builder: RequestBuilder, online_id: str) User [source]#
Creates the User instance from online ID and returns the instance.
- Parameters:
request_builder (RequestBuilder) – Used to call http requests.
online_id (str) – Online ID (GamerTag) of the user.
- Returns:
User Class object which represents a PlayStation account
- Return type:
- Raises:
PSNAWPNotFound
If the user is not valid/found.
- classmethod from_account_id(request_builder: RequestBuilder, account_id: str) User [source]#
Creates the User instance from account ID and returns the instance.
- Parameters:
request_builder (RequestBuilder) – Used to call http requests.
account_id (str) – Account ID of the user.
- Returns:
User Class object which represents a PlayStation account
- Return type:
- Raises:
PSNAWPNotFound
If the user is not valid/found.
- __init__(request_builder: RequestBuilder, online_id: str, account_id: str)[source]#
Constructor of Class User.
Note
This class is intended to be interfaced with through PSNAWP.
- Parameters:
request_builder (RequestBuilder) – Used to call http requests.
online_id (str) – Online ID (GamerTag) of the user.
account_id (str) – Account ID of the user.
- Raises:
PSNAWPIllegalArgumentError
If both online_id and account_id are not provided.- Raises:
PSNAWPNotFound
If the online id or account id is not valid/found.
- profile() dict[str, Any] [source]#
Gets the profile of the user such as about me, avatars, languages etc…
- Returns:
A dict containing info similar to what is shown below:
- Return type:
dict[str, Any]
{ "onlineId": "VaultTec-Co", "aboutMe": "r/Fallout76Marketplace Moderator", "avatars": [ { "size": "s", "url": "[Redacted]" }, { "size": "xl", "url": "[Redacted]" }, { "size": "l", "url": "[Redacted]" }, { "size": "m", "url": "[Redacted]" } ], "languages": [ "en-US" ], "isPlus": false, "isOfficiallyVerified": false, "isMe": false }
user_example = psnawp.user(online_id='VaultTec_Trading') print(user_example.profile())
- get_presence() dict[str, Any] [source]#
Gets the presences of a user. If the profile is private
- Returns:
A dict containing info similar to what is shown below:
- Return type:
dict[str, Any]
{ "availability": "availableToPlay", "primaryPlatformInfo": { "onlineStatus": "online", "platform": "ps4", "lastOnlineDate": "2022-09-15T22:50:28.012Z" } }
- Raises:
PSNAWPForbidden
When the user’s profile is private, and you don’t have permission to view their online status.
user_example = psnawp.user(online_id='VaultTec_Trading') print(user_example.get_presence())
- friendship() dict[str, Any] [source]#
Gets the friendship status and stats of the user
- Returns:
A dict containing info similar to what is shown below
- Return type:
dict[str, Any]
{ "friendRelation": "friend", "personalDetailSharing": "none", "friendsCount": 419, "mutualFriendsCount": 0 }
user_example = psnawp.user(online_id='VaultTec_Trading') print(user_example.friendship())
- is_blocked() bool [source]#
Checks if the user is blocked by you
- Returns:
True if the user is blocked otherwise False
- Return type:
user_example = psnawp.user(online_id='VaultTec_Trading') print(user_example.is_blocked())
- trophy_summary() 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:
Trophy Summary Object containing all information
- Return type:
- Raises:
PSNAWPForbidden
If the user’s profile is private
user_example = psnawp.user(online_id="VaultTec_Trading") print(user_example.trophy_summary())
- trophy_titles(limit: int | None = 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
user_example = psnawp.user(online_id="VaultTec_Trading") for trophy_title in user_example.trophy_titles(limit=None): print(trophy_title)
- trophy_titles_for_title(title_ids: list[str]) Iterator[TrophyTitle] [source]#
Retrieve a summary of the trophies earned by a user for specific titles.
Note
title_id
can be obtained from https://andshrew.github.io/PlayStation-Titles/ or frompsnawp_api.models.search.Search.get_title_id()
- Parameters:
- Returns:
Generator object with TitleTrophySummary objects
- Return type:
Iterator[TrophyTitle]
- Raises:
PSNAWPForbidden
If the user’s profile is private
user_example = psnawp.user(online_id="VaultTec_Trading") for trophy_title in user_example.trophy_titles_for_title(title_ids=['CUSA00265_00']): print(trophy_title)
- trophies(np_communication_id: str, platform: Literal['PS Vita', 'PS3', 'PS4', 'PS5'], trophy_group_id: str = 'default', limit: int | None = None, include_metadata: bool = False) Iterator[Trophy] [source]#
Retrieves the earned status individual trophy detail of a single - or all - trophy groups for a title.
- Parameters:
np_communication_id (str) – Unique ID of the title used to request trophy information
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.
include_metadata (bool) – If True, will fetch metadata for trophy such as name and detail
Warning
Setting
include_metadata
toTrue
will use twice the amount of rate limit since the API wrapper has to obtain metadata from a separate endpoint.- 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
- trophy_groups_summary(np_communication_id: str, platform: Literal['PS Vita', 'PS3', 'PS4', 'PS5'], include_metadata: bool = False) 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:
np_communication_id (str) – Unique ID of the title used to request trophy information
platform (Literal) – The platform this title belongs to.
platform – The platform this title belongs to.
include_metadata (bool) – If True, will fetch results from another endpoint and include metadata for trophy group such as name and detail
Warning
Setting
include_metadata
toTrue
will use twice the amount of rate limit since the API wrapper has to obtain metadata from a separate endpoint.- 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
- title_stats(*, limit: int | None = None, offset: int = 0, page_size: int = 200) TitleStatsListing [source]#
Retrieve a list of titles with their stats and basic meta-data
- Parameters:
Warning
Only returns data for PS4 games and above.
- Returns:
Iterator class for TitleStats
- Return type:
Iterator[TitleStatsListing]
user_example = psnawp.user(online_id='jeranther') for title in user_example.title_stats(): ...