psnawp_api.models package#

Subpackages#

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:

str

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:

str

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.

Parameters:
  • limit (int) – The number of groups to receive.

  • offset (int) – Lets you exclude first N items groups. Offset = 10 lets you skip the first 10 groups.

Returns:

Iterator of Group Objects.

Return type:

Iterator[Group]

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:

TrophySummary

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.

Parameters:

title_ids (list[str]) – Unique ID of the title

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 to True 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 to True 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:

TrophyGroupsSummary

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:
  • limit (Optional[int]) – Limit of titles returned.

  • page_size (int) – The number of items to receive per api request.

  • offset (int) – Specifies the offset for paginator

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.

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:

TrophyGroupsSummary

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:

dict[str, Any]

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:

dict[str, str]

{
    "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
}

leave_group() None[source]#

Leave the current group

Raises:

PSNAWPNotFound If you are not part of the group.

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.

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:
  • search_query (str) – search query

  • limit (int) – Limit of number of results

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.

Parameters:

title_name (str) – Video Game title name

Returns:

A tuple containing English Title Name and Title ID

Return type:

tuple[str, str]

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.

title_id: str | None#

Game title id

name: str | None#

Game title name

image_url: str | None#

Image URL

category: PlatformCategory | None#

Category/Platform Type

play_count: int | None#

Number of times the game has been played

first_played_date_time: datetime | None#

First time the game was played

last_played_date_time: datetime | None#

Last time the game was played

play_duration: timedelta | None#

PT1H51M21S

Type:

Total time the game has been played. Example

classmethod from_dict(game_stats_dict: dict[str, Any]) TitleStats[source]#
classmethod from_endpoint(request_builder: RequestBuilder, account_id: str, limit: int | None) Iterator[TitleStats][source]#
__init__(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) None#

Method generated by attrs for class TitleStats.

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:
  • count (int) – The count of retrieved title statistics.

  • total_item_count (int) – The total count of title statistics. Note that this won’t be accurate until the first item is fetched. Also, it can be retrieved using len() function.

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:

User

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:

User

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:

bool

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:

TrophySummary

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.

Parameters:

title_ids (list[str]) – Unique ID of the title

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 to True 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 to True 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:

TrophyGroupsSummary

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:
  • limit (Optional[int]) – Limit of titles returned.

  • page_size (int) – The number of items to receive per api request.

  • offset (int) – Specifies the offset for paginator

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():
    ...

Module contents#