psnawp_api.core package — PSNAWP 1.1.0 documentation

# psnawp_api.core package

## Submodules

## psnawp_api.core.authenticator module

class Authenticator(npsso_cookie: str)

  Bases: `object`

  Provides an interface for PSN Authentication.

  __init__(npsso_cookie: str)

    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

    Gets a new access token from refresh token.

    Returns

      access token

  oauth_token(code: str) → None

    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

  Bases: `Exception`

  Base Exception for all PSNAWP Exceptions.

exception PSNAWPAuthenticationError

  Bases: `PSNAWPException`

  Exception for authentication related errors.

exception PSNAWPBadRequest

  Bases: `PSNAWPException`

  Exception raised if bad request is made to the endpoint.

exception PSNAWPIllegalArgumentError

  Bases: `PSNAWPException`

  Exception raised if user gave wrong input to a function.

exception PSNAWPUnauthorized

  Bases: `PSNAWPException`

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

exception PSNAWPForbidden

  Bases: `PSNAWPException`

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

exception PSNAWPNotFound

  Bases: `PSNAWPException`

  Exception raised if resource not found.

exception PSNAWPNotAllowed

  Bases: `PSNAWPException`

  Exception raised if resource doesn’t support this method.

exception PSNAWPServerError

  Bases: `PSNAWPException`

  Exception raised if there is a problem at the server.

## Module contents