psnawp_api.core package#

Submodules#

psnawp_api.core.authenticator module#

class Authenticator(npsso_cookie: str)[source]#

Bases: object

Provides an interface for PSN Authentication.

__init__(npsso_cookie: str)[source]#

Represents a single authentication to PSN API.

Parameters:

npsso_cookie – npsso cookie obtained from PSN website.

Raises:

PSNAWPAuthenticationError If npsso code is expired or is incorrect.

obtain_fresh_access_token() Any[source]#

Gets a new access token from refresh token.

Returns:

access token

oauth_token(code: str) None[source]#

Obtain the access token using oauth code for the first time, after this the access token is obtained via refresh token.

Parameters:

code – Code obtained using npsso code.

psnawp_api.core.psnawp_exceptions module#

exception PSNAWPException[source]#

Bases: Exception

Base Exception for all PSNAWP Exceptions.

exception PSNAWPAuthenticationError[source]#

Bases: PSNAWPException

Exception for authentication related errors.

exception PSNAWPBadRequest[source]#

Bases: PSNAWPException

Exception raised if bad request is made to the endpoint.

exception PSNAWPIllegalArgumentError[source]#

Bases: PSNAWPException

Exception raised if user gave wrong input to a function.

exception PSNAWPUnauthorized[source]#

Bases: PSNAWPException

Exception for accessing an action is not allowed due to missing the right authorization.

exception PSNAWPForbidden[source]#

Bases: PSNAWPException

Exception for accessing an action is not allowed due to insufficient rights to a resource.

exception PSNAWPNotFound[source]#

Bases: PSNAWPException

Exception raised if resource not found.

exception PSNAWPNotAllowed[source]#

Bases: PSNAWPException

Exception raised if resource doesn’t support this method.

exception PSNAWPServerError[source]#

Bases: PSNAWPException

Exception raised if there is a problem at the server.

Module contents#