# Nordigen Account
A Python package to interact with the Nordigen Bank Account API, allowing users to retrieve and manage bank account
details and balances.
## Features
- Secure connection to the Nordigen API using `secret_id` and `secret_key`.
- Retrieve bank account details such as name, status, and currency.
- Fetch account balances, including multiple balance types and currencies.
- Manage multiple linked accounts via the `BankAccountManager` class.
- Automatic retrieval of new refresh token when expired.
## Installation
Ensure Python 3.7+ is installed. To install the package, use:
```bash
pip install nordigen
```
## Generating Credentials
To use this package, you need to obtain credentials from Nordigen, which include:
- `secret_id`
- `secret_key`
- `refresh_token`
- `requisition_id`
Follow these steps to generate the credentials:
1. Go to the Nordigen Bank Account Data API portal:\
[https://developer.gocardless.com/bank-account-data/overview](https://developer.gocardless.com/bank-account-data/overview)
2. Sign up for an account and log in.
3. Navigate to the **API Keys** section to generate your `secret_id` and `secret_key`.
4. Follow the API documentation steps to create a requisition and obtain a `requisition_id`.
The `refresh_token` is retrieved when you generate an access token via the API.
Once you have obtained these credentials, you can use them to connect to the API and fetch your bank account details.
The `refresh_token` will expire every 30 days and the `requisition_id` every 90 days and must be refreshed.
## Usage
### 1. Instantiate the Nordigen Client
Use the `create_nordigen_client` function to instantiate the Nordigen client with the required credentials.
You can pass an optional refresh token, but if not provided, the function will attempt to generate a new one using the
provided `secret_id` and `secret_key`.
```python
from nordigen_account import create_nordigen_client
# Replace with your actual credentials
secret_id = "your-secret-id"
secret_key = "your-secret-key"
refresh_token = "your-refresh-token" # Optional
client, new_refresh_token = create_nordigen_client(secret_id, secret_key, refresh_token)
```
If your refresh token has expired, the function will automatically generate a new one.
The function will return a tuple containing the client instance and a new `refresh_token` if generated, or `None` if
the existing token is still valid.
**Handling refresh tokens:**
If a new `refresh_token` is generated, make sure to update your stored credentials for subsequent API requests.
```python
client, new_refresh_token = create_nordigen_client(secret_id, secret_key, refresh_token)
if new_refresh_token:
print("New refresh token generated:", new_refresh_token)
# Store the new token securely for future API requests
```
### 2. Manage Multiple Accounts
The `BankAccountManager` class manages multiple bank accounts linked to a requisition ID.
When you instantiate `BankAccountManager`, it automatically initializes instances of the `BankAccount` class for each
linked account.
```python
from nordigen_account import BankAccountManager
requisition_id = "your-requisition-id"
# Instantiate account manager
manager = BankAccountManager(client, requisition_id, fetch_data=True)
# Access account details
for account in manager.accounts:
print("Account ID:", account._account_id)
print("Balances:", account.balances)
```
By default `BankAccount` data is not collected when you initialize `BankAccountManager`. To optionally collect account
data, set the `fetch_data` flag to True.
### 3. Data Properties
Two data sets are currently supported:
1. Account details
- currency
- status
- name
2. Account balances data
- balanceType
- currency
- amount
To access / refresh each data set use the following commands:
```python
for account in manager.accounts:
account.update_account_data()
account.update_balance_data()
```
### 4. Error handling
The code raises `ValueError` for:
- Expired requisition (status EX).
- No linked accounts, which suggests bank authorization has not been completed.
If your requisition has expired or bank authorization has not been completed follow steps in the Nordigen official
documentation to generate a new requisition or complete bank authorization.
## Project Structure
```
nordigen_account/
|-- nordigen_account/
| |-- __init__.py # Core functionality and class definitions
|-- setup.py # Package configuration for distribution
|-- requirements.txt # Dependencies
|-- LICENSE # License information
|-- README.md # Project documentation
|-- MANIFEST.in # Package manifest
```
## Dependencies
The package requires the following dependency:
- `nordigen` – Python client for Nordigen API.
The dependency is listed in the `requirements.txt` file.
## Setup for Development
To set up the project locally:
1. Clone the repository:
```bash
git clone https://github.com/rahulpdev/nordigen_account.git
cd nordigen_account
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Run tests or explore the package functionality.
## Contributing
Contributions are welcome! Please follow these steps:
1. Fork the repository.
2. Create a new feature branch.
3. Commit your changes.
4. Push the branch and open a pull request.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Author
**Rahul Parmar**\
[GitHub Profile](https://github.com/rahulpdev)
---
For more details on the Nordigen API, visit their
[official documentation](https://developer.gocardless.com/bank-account-data/overview).
Raw data
{
"_id": null,
"home_page": "https://github.com/rahulpdev/nordigen_account",
"name": "nordigen-account",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "nordigen api bank accounts finance",
"author": "Rahul Parmar",
"author_email": "rahulparmaruk@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/7c/11/bc435ab8e9e3680a9aa07fd5cefd283677dc5538225825fafd65faf936c2/nordigen_account-0.2.0.tar.gz",
"platform": null,
"description": "# Nordigen Account\n\nA Python package to interact with the Nordigen Bank Account API, allowing users to retrieve and manage bank account \ndetails and balances.\n\n## Features\n\n- Secure connection to the Nordigen API using `secret_id` and `secret_key`.\n- Retrieve bank account details such as name, status, and currency.\n- Fetch account balances, including multiple balance types and currencies.\n- Manage multiple linked accounts via the `BankAccountManager` class.\n- Automatic retrieval of new refresh token when expired.\n\n## Installation\nEnsure Python 3.7+ is installed. To install the package, use:\n\n```bash\npip install nordigen\n```\n\n## Generating Credentials\n\nTo use this package, you need to obtain credentials from Nordigen, which include:\n\n- `secret_id`\n- `secret_key`\n- `refresh_token`\n- `requisition_id`\n\nFollow these steps to generate the credentials:\n\n1. Go to the Nordigen Bank Account Data API portal:\\\n [https://developer.gocardless.com/bank-account-data/overview](https://developer.gocardless.com/bank-account-data/overview)\n2. Sign up for an account and log in.\n3. Navigate to the **API Keys** section to generate your `secret_id` and `secret_key`.\n4. Follow the API documentation steps to create a requisition and obtain a `requisition_id`. \n The `refresh_token` is retrieved when you generate an access token via the API.\n\nOnce you have obtained these credentials, you can use them to connect to the API and fetch your bank account details. \nThe `refresh_token` will expire every 30 days and the `requisition_id` every 90 days and must be refreshed.\n\n## Usage\n\n### 1. Instantiate the Nordigen Client\n\nUse the `create_nordigen_client` function to instantiate the Nordigen client with the required credentials. \nYou can pass an optional refresh token, but if not provided, the function will attempt to generate a new one using the \nprovided `secret_id` and `secret_key`.\n\n```python\nfrom nordigen_account import create_nordigen_client\n\n# Replace with your actual credentials\nsecret_id = \"your-secret-id\"\nsecret_key = \"your-secret-key\"\nrefresh_token = \"your-refresh-token\" # Optional\n\nclient, new_refresh_token = create_nordigen_client(secret_id, secret_key, refresh_token)\n```\n\nIf your refresh token has expired, the function will automatically generate a new one. \nThe function will return a tuple containing the client instance and a new `refresh_token` if generated, or `None` if \nthe existing token is still valid. \n\n**Handling refresh tokens:** \nIf a new `refresh_token` is generated, make sure to update your stored credentials for subsequent API requests.\n\n```python\nclient, new_refresh_token = create_nordigen_client(secret_id, secret_key, refresh_token)\n\nif new_refresh_token:\n print(\"New refresh token generated:\", new_refresh_token)\n # Store the new token securely for future API requests\n\n```\n\n### 2. Manage Multiple Accounts\n\nThe `BankAccountManager` class manages multiple bank accounts linked to a requisition ID. \nWhen you instantiate `BankAccountManager`, it automatically initializes instances of the `BankAccount` class for each \nlinked account. \n\n```python\nfrom nordigen_account import BankAccountManager\n\nrequisition_id = \"your-requisition-id\"\n\n# Instantiate account manager\nmanager = BankAccountManager(client, requisition_id, fetch_data=True)\n\n# Access account details\nfor account in manager.accounts:\n print(\"Account ID:\", account._account_id)\n print(\"Balances:\", account.balances)\n```\nBy default `BankAccount` data is not collected when you initialize `BankAccountManager`. To optionally collect account \ndata, set the `fetch_data` flag to True.\n\n### 3. Data Properties\nTwo data sets are currently supported:\n\n1. Account details\n- currency\n- status\n- name\n2. Account balances data\n- balanceType\n- currency\n- amount\n\nTo access / refresh each data set use the following commands:\n\n```python\nfor account in manager.accounts:\n account.update_account_data()\n account.update_balance_data()\n```\n\n### 4. Error handling\n\nThe code raises `ValueError` for:\n- Expired requisition (status EX).\n- No linked accounts, which suggests bank authorization has not been completed.\n\nIf your requisition has expired or bank authorization has not been completed follow steps in the Nordigen official \ndocumentation to generate a new requisition or complete bank authorization. \n\n## Project Structure\n\n```\nnordigen_account/\n|-- nordigen_account/\n| |-- __init__.py # Core functionality and class definitions\n|-- setup.py # Package configuration for distribution\n|-- requirements.txt # Dependencies\n|-- LICENSE # License information\n|-- README.md # Project documentation\n|-- MANIFEST.in # Package manifest\n```\n\n## Dependencies\n\nThe package requires the following dependency:\n\n- `nordigen` \u2013 Python client for Nordigen API.\n\nThe dependency is listed in the `requirements.txt` file.\n\n## Setup for Development\n\nTo set up the project locally:\n\n1. Clone the repository:\n\n ```bash\n git clone https://github.com/rahulpdev/nordigen_account.git\n cd nordigen_account\n ```\n\n2. Install dependencies:\n\n ```bash\n pip install -r requirements.txt\n ```\n\n3. Run tests or explore the package functionality.\n\n## Contributing\n\nContributions are welcome! Please follow these steps:\n\n1. Fork the repository.\n2. Create a new feature branch.\n3. Commit your changes.\n4. Push the branch and open a pull request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Author\n\n**Rahul Parmar**\\\n[GitHub Profile](https://github.com/rahulpdev)\n\n---\n\nFor more details on the Nordigen API, visit their \n[official documentation](https://developer.gocardless.com/bank-account-data/overview).\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python package to interact with Nordigen API for bank account management.",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://github.com/rahulpdev/nordigen_account"
},
"split_keywords": [
"nordigen",
"api",
"bank",
"accounts",
"finance"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "748c15f7046860faa1a18a787287c1274486976836a4ab33c5fa64e57074ba50",
"md5": "aa3399a0b28f0180da5fb3c7caab5cdf",
"sha256": "175e982145a10d4671549f2e782dfc1750a1de7257e89fd12baae11c2faf4a79"
},
"downloads": -1,
"filename": "nordigen_account-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "aa3399a0b28f0180da5fb3c7caab5cdf",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 6312,
"upload_time": "2025-01-26T11:37:07",
"upload_time_iso_8601": "2025-01-26T11:37:07.358622Z",
"url": "https://files.pythonhosted.org/packages/74/8c/15f7046860faa1a18a787287c1274486976836a4ab33c5fa64e57074ba50/nordigen_account-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7c11bc435ab8e9e3680a9aa07fd5cefd283677dc5538225825fafd65faf936c2",
"md5": "0d698fbb0e198c6093e9b29de21ce9d0",
"sha256": "95c92581b4e6ba30f4e05ee4f812816d615a981698ef1dea99c6e167f5e43957"
},
"downloads": -1,
"filename": "nordigen_account-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "0d698fbb0e198c6093e9b29de21ce9d0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 6092,
"upload_time": "2025-01-26T11:37:08",
"upload_time_iso_8601": "2025-01-26T11:37:08.323634Z",
"url": "https://files.pythonhosted.org/packages/7c/11/bc435ab8e9e3680a9aa07fd5cefd283677dc5538225825fafd65faf936c2/nordigen_account-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-26 11:37:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "rahulpdev",
"github_project": "nordigen_account",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "nordigen",
"specs": [
[
"==",
"1.4.1"
]
]
}
],
"lcname": "nordigen-account"
}