psnawp_api package
Subpackages
- psnawp_api.core package
- psnawp_api.models package
- Subpackages
- psnawp_api.models.trophies package
- Submodules
- psnawp_api.models.trophies.trophy module
- psnawp_api.models.trophies.trophy_constants module
- psnawp_api.models.trophies.trophy_group module
- psnawp_api.models.trophies.trophy_summary module
- psnawp_api.models.trophies.trophy_titles module
- psnawp_api.models.trophies.utility_functions module
- Module contents
- psnawp_api.models.trophies package
- Submodules
- psnawp_api.models.client module
Client
Client.__init__()
Client.online_id
Client.account_id
Client.get_profile_legacy()
Client.get_account_devices()
Client.friends_list()
Client.available_to_play()
Client.blocked_list()
Client.get_groups()
Client.trophy_summary()
Client.trophy_titles()
Client.trophy_titles_for_title()
Client.trophies()
Client.trophy_groups_summary()
Client.title_stats()
- psnawp_api.models.game_title module
- psnawp_api.models.group module
- psnawp_api.models.search module
- psnawp_api.models.title_stats module
- psnawp_api.models.user module
- Module contents
- Subpackages
- psnawp_api.utils package
Submodules
psnawp_api.psnawp module
- class PSNAWP(npsso_cookie: str)[source]
Bases:
object
PlayStation Network API Wrapper Python (PSNAWP) Retrieve User Information, Trophies, Game and Store data from the PlayStation Network.
Instances of this class are the gateway to interacting with PSN API through PSNAWP.
from psnawp_api import PSNAWP psnawp = PSNAWP('<64 character npsso code>')
- __init__(npsso_cookie: str)[source]
Constructor Method. Takes the npsso_cookie and creates instance of
request_builder.RequestBuilder
which is used later in code for HTTPS requests.- Parameters
npsso_cookie (str) – npsso cookie obtained from PSN website.
- Raises
PSNAWPAuthenticationError
If npsso code is expired or is incorrect.
- me() Client [source]
Creates a new client object (your account).
- Returns
Client Object
- Return type
from psnawp_api import PSNAWP psnawp = PSNAWP('<64 character npsso code>') client = psnawp.me()
- user(*, online_id: str) User [source]
- user(*, account_id: str) User
Creates a new user object using Online ID (GamerTag) or Account ID (PSN ID).
Note
The account_id takes higher precedence than online_id. If both arguments are passed, online_id will be ignored.
- Parameters
kwargs (dict) – online_id (str): Online ID (GamerTag) of the user. account_id (str): Account ID of the user.
- Returns
User Object
- Return type
- Raises
PSNAWPIllegalArgumentError If None of the kwargs are passed.
- Raises
PSNAWPNotFound
If the online_id or account_id is not valid/found.
user1 = psnawp.user(online_id="VaultTec_Trading") user2 = psnawp.user(account_id='1802043923080044300')
- game_title(title_id: str, account_id: str = '6515971742264256071', np_communication_id: Optional[str] = None) GameTitle [source]
Creates a GameTitle class object from title_id which represents a PlayStation video game title.
Note
The GameTitle class is only useful if the user has played that video game. To allow users to retrieve information without having to play that video game I picked a default user who has played the most number of games based on this website (https://www.truetrophies.com/leaderboard/gamer/gamesplayed). It is possible that the there are games this user has not played and in that case it is better to provide your own account id (
'me'
) or someone who has played that game.Note
title_id
can be obtained from https://andshrew.github.io/PlayStation-Titles/ or frompsnawp_api.models.search.Search.get_title_id()
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. This call can be skipped by providing np_communication_id in as argument.
- Parameters
- Param
account_id: The account whose trophy list is being accessed
- Returns
Title Object
- Return type
- Raises
PSNAWPNotFound
If the user does not have any trophies for that game or the game doesn’t exist.
- group(*, group_id: str) Group [source]
- group(*, users_list: Iterator[User]) Group
Creates a group object from a Group ID or from list of users.
Warning
Passing
users_list
will create a new group each time. If you want to continue from the same group. Use group id obtained fromclient.get_groups()
- Parameters
kwargs – group_id (str): The Group ID of a group usually retrieved with the get_groups() method. users_list(Iterator[User]): A list of users of the members in the group.
- Returns
Group Object
- Return type
- Raises
PSNAWPIllegalArgumentError
If None or Both kwargs are passed.- Raises
PSNAWPForbidden
If you are Dming a user who has blocked you.