3.1.1.1. nordigen_cli.apiclient package

3.1.1.1.1. Submodules

3.1.1.1.2. nordigen_cli.apiclient.authentication module

class nordigen_cli.apiclient.authentication.RefreshableHeaderAuthentication(token: AccessToken = None, parameter: str = 'Authorization', scheme: str | None = 'Bearer', extra: dict[str, str] | None = None)[source]

Bases: BaseAuthenticationMethod

get_headers() dict[str, str][source]
get_token() AccessToken[source]
set_token(token: AccessToken)[source]

3.1.1.1.3. nordigen_cli.apiclient.base module

class nordigen_cli.apiclient.base.ClientState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

ACCESS_TOKEN_ACTIVE = 4
ACCESS_TOKEN_INVALID = 5

a resource request failed with an invalid access token

INITIAL = 1
NO_TOKENS = 3

no tokens initially provided

TOKENS_CACHED = 2

initial inspection provided both tokens with valid expiry

TOKEN_PAIR_REQUEST_FAILED = 7

token pair request failed

TOKEN_REFRESH_REQUEST_FAILED = 6

refresh token request failed

class nordigen_cli.apiclient.base.NordigenClientBase(*, id=None, key=None, api=None, **kwargs)[source]

Bases: object

property access_token: AccessToken
base_url: str = ''
delete(url: str, params: dict = None, **kwargs)[source]
do_init: bool = True
do_refresh(method: str, endpoint: str, depth: int = 0, /, **kwargs)[source]
do_signon(**kwargs)[source]
do_signon_request(method, url, depth: int = 0, **kwargs)[source]
do_token_refresh(**params)[source]
endpoints

alias of Endpoints

get(url: str, params: dict = None, **kwargs)[source]
get_access_token() AccessToken[source]
get_refresh_token() RefreshToken[source]
init(secret_id, secret_key, api, **kwargs)[source]
post(url: str, data: dict, params: dict = None, **kwargs)[source]
prerequest(method: str, url: str, depth: int = 0, /, **kwargs)[source]
r_client: ResourceClient = None
refresh_callback: Callable = None
property refresh_token: RefreshToken
request(method: str, endpoint: str, depth: int, /, **kwargs)[source]
retrieve_callback: Callable = None
set_access_token(token: AccessToken)[source]
set_refresh_token(token: RefreshToken)[source]
signon_callback: Callable = None
state: ClientState = 1
t_client: TokenClient = None
class nordigen_cli.apiclient.base.ResourceClient(**kwargs)[source]

Bases: APIClient

Nordigen API client implementing Oauth2 implement oauth2 token refresh flow states

base_url: str = ''
endpoints

alias of Endpoints

get_authentication_method() RefreshableHeaderAuthentication[source]
get_request_timeout()[source]

Return the number of seconds before the request times out.

is_valid_token() bool[source]
class nordigen_cli.apiclient.base.TokenClient(**kwargs)[source]

Bases: APIClient

check_refresh_token()[source]
do_get_token_new(*args, **params) SpectacularJWTObtain[source]
do_post_token_refresh(**params) AccessToken[source]
endpoints

alias of Endpoints

get_tokens(*args, **kwargs) tuple[AccessToken, RefreshToken][source]
refresh_token: RefreshToken = None
secret_id: str = None
secret_key: str = None

3.1.1.1.4. nordigen_cli.apiclient.client module

class nordigen_cli.apiclient.client.NordigenClient(*, id=None, key=None, api=None, **kwargs)[source]

Bases: NordigenClientBase

accept_agreement(agreement_id, user_agent, ip_address)[source]
create_end_user_agreement(bank_id, enduser_id, max_historical_days=90)[source]
create_requisition(*, redirect: str, institution_id, agreement: UUID = None, reference: str = None, user_language='EN', ssn: str | None, account_selection: bool | None = False, redirect_immediate: bool | None = False) SpectacularRequisition[source]
delete_agreement(agreement_id)[source]
delete_requisition(requisition_id: UUID)[source]
list_account_transactions(account_id: UUID) AccountTransactions[source]
list_agreements(limit: int = 100, offset: int = 0) list[EndUserAgreement][source]
list_banks(code, /, **kwargs) list[Integration][source]
list_requisitions(limit: int = 100, offset: int = 0) list[Requisition][source]
show_account_balances(account_id: UUID)[source]
show_account_details(account_id: UUID)[source]
show_account_metadata(account_id: UUID)[source]
show_agreement(agreement_id: UUID) EndUserAgreement[source]
show_bank(bank_id, /, **kwargs) IntegrationRetrieve[source]
show_requisition(requisition_id)[source]

3.1.1.1.5. nordigen_cli.apiclient.endpoints module

class nordigen_cli.apiclient.endpoints.BaseEndpoints[source]

Bases: object

account_balances = 'accounts/{id}/balances/'
account_details = 'accounts/{id}/details/'
account_metadata = 'accounts/{id}/'
agreement = 'agreements/enduser/{id}/'
agreement_accept = 'agreements/enduser/{agreement_id}/accept/'
agreements = 'agreements/enduser/'
bank = 'institutions/{id}/'
banks = 'institutions/?country={code}'
requisition = 'requisitions/{id}/'
requisitions = 'requisitions/'
token_new = 'token/new/'
token_refresh = 'token/refresh/'
transactions = 'accounts/{id}/transactions/'
class nordigen_cli.apiclient.endpoints.Endpoints[source]

Bases: object

account_balances = 'xxxhttps://bankaccountdata.gocardless.com/api/v2/accounts/{account_id}/balances/'
account_details = 'xxxhttps://bankaccountdata.gocardless.com/api/v2/accounts/{account_id}/details/'
account_metadata = 'xxxhttps://bankaccountdata.gocardless.com/api/v2/accounts/{account_id}/metadata/'
agreement = 'xxxhttps://bankaccountdata.gocardless.com/api/v2/agreements/enduser/{id}/'
agreement_accept = 'xxxhttps://bankaccountdata.gocardless.com/api/v2/agreements/enduser/{agreement_id}/accept/'
agreements = 'xxxhttps://bankaccountdata.gocardless.com/api/v2/agreements/enduser/'
bank = 'xxxhttps://bankaccountdata.gocardless.com/api/v2/institutions/{id}/'
banks = 'xxxhttps://bankaccountdata.gocardless.com/api/v2/institutions/?country={code}'
requisition = 'xxxhttps://bankaccountdata.gocardless.com/api/v2/requisitions/{id}/'
requisitions = 'xxxhttps://bankaccountdata.gocardless.com/api/v2/requisitions/'
token_new = 'xxxhttps://bankaccountdata.gocardless.com/api/v2/token/new/'
token_refresh = 'xxxhttps://bankaccountdata.gocardless.com/api/v2/token/refresh/'
transactions = 'xxxhttps://bankaccountdata.gocardless.com/api/v2/accounts/{id}/transactions/'

3.1.1.1.6. nordigen_cli.apiclient.errors module

exception nordigen_cli.apiclient.errors.AuthenticationFailedError(response: Response, **kwargs)[source]

Bases: NordigenClientError

exception nordigen_cli.apiclient.errors.InvalidTokenError(response: Response, **kwargs)[source]

Bases: NordigenClientError

exception nordigen_cli.apiclient.errors.NordigenClientError(response: Response, **kwargs)[source]

Bases: ClientError

Client error which has fields for ErrorResponse objects

Parameters:
  • response (Response) – Response object

  • message (str) – Error message

  • status_code (int) – HTTP status code

  • info (dict) – Raw data from response

Note

doesn’t seem to pass type though in any response

Example

This is an example of the error response from the Nordigen API:

{
    "summary": "Authentication failed",
    "detail": "No active account found with the given credentials",
    "status_code": 401
    "type": null
}
response: Response
exception nordigen_cli.apiclient.errors.OtherAuthenticationError(response: Response, **kwargs)[source]

Bases: NordigenClientError

exception nordigen_cli.apiclient.errors.PageNotFoundError(response: Response, **kwargs)[source]

Bases: NordigenClientError

class nordigen_cli.apiclient.errors.ResourceErrorHandler[source]

Bases: BaseErrorHandler

static get_exception(response: Response) APIRequestError[source]
class nordigen_cli.apiclient.errors.SignonErrorHandler[source]

Bases: ResourceErrorHandler

static get_exception(response: Response) APIRequestError[source]
exception nordigen_cli.apiclient.errors.TokenExpiredError(response: Response, **kwargs)[source]

Bases: NordigenClientError

exception nordigen_cli.apiclient.errors.TokenFormatError[source]

Bases: ValueError

3.1.1.1.7. Module contents