# Nordigen Python
This is official Python client library for [GoCardless Bank Account Data](https://gocardless.com/bank-account-data/) API
For a full list of endpoints and arguments, see the [docs](https://developer.gocardless.com/bank-account-data/quick-start-guide).
Before starting to use API you will need to create a new secret and get your `SECRET_ID` and `SECRET_KEY` from the [GoCardless Bank Account Data Portal](https://bankaccountdata.gocardless.com/user-secrets/).
## Requirements
* Python >= 3.8
## Installation
Install library via pip package manager:
```
pip install nordigen
```
## Example application
Example code can be found in `main.py` file and Flask application can be found in the `example` directory
## Quickstart
```python
from uuid import uuid4
from nordigen import NordigenClient
# initialize Nordigen client and pass SECRET_ID and SECRET_KEY
client = NordigenClient(
secret_id="SECRET_ID",
secret_key="SECRET_KEY"
)
# Create new access and refresh token
# Parameters can be loaded from .env or passed as a string
# Note: access_token is automatically injected to other requests after you successfully obtain it
token_data = client.generate_token()
# Use existing token
client.token = "YOUR_TOKEN"
# Exchange refresh token for new access token
new_token = client.exchange_token(token_data["refresh"])
# Get institution id by bank name and country
institution_id = client.institution.get_institution_id_by_name(
country="LV",
institution="Revolut"
)
# Get all institution by providing country code in ISO 3166 format
institutions = client.institution.get_institutions("LV")
# Initialize bank session
init = client.initialize_session(
# institution id
institution_id=institution_id,
# redirect url after successful authentication
redirect_uri="https://gocardless.com",
# additional layer of unique ID defined by you
reference_id=str(uuid4())
)
# Get requisition_id and link to initiate authorization process with a bank
link = init.link # bank authorization link
requisition_id = init.requisition_id
```
After successful authorization with a bank you can fetch your data (details, balances, transactions)
---
## Fetching account metadata, balances, details and transactions
```python
# Get account id after you have completed authorization with a bank
# requisition_id can be gathered from initialize_session response
accounts = client.requisition.get_requisition_by_id(
requisition_id=init.requisition_id
)
# Get account id from the list.
account_id = accounts["accounts"][0]
# Create account instance and provide your account id from previous step
account = client.account_api(id=account_id)
# Fetch account metadata
meta_data = account.get_metadata()
# Fetch details
details = account.get_details()
# Fetch balances
balances = account.get_balances()
# Fetch transactions
transactions = account.get_transactions()
# Filter transactions by specific date range
transactions = account.get_transactions(date_from="2021-12-01", date_to="2022-01-21")
```
## Premium endpoints
```python
# Get premium transactions. Country and date parameters are optional
premium_transactions = account.get_premium_transactions(
country="LV",
date_from="2021-12-01",
date_to="2022-01-21"
)
# Get premium details
premium_details = account.get_premium_details()
```
## Support
For any inquiries please contact support at [bank-account-data-support@gocardless.com](bank-account-data-support@gocardless.com) or create an issue in repository.
Raw data
{
"_id": null,
"home_page": "https://github.com/nordigen/nordigen-python",
"name": "nordigen",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": "GoCardless, Nordigen, Nordigen API, OpenBanking",
"author": "Nordigen Solutions",
"author_email": "bank-account-data-support@gocardless.com",
"download_url": "https://files.pythonhosted.org/packages/e5/7e/1d42c627e2c918ec2b1f6890915d27896a91d6abfd22d1d32125bd9cd7dc/nordigen-1.4.1.tar.gz",
"platform": null,
"description": "# Nordigen Python\n\nThis is official Python client library for [GoCardless Bank Account Data](https://gocardless.com/bank-account-data/) API\n\nFor a full list of endpoints and arguments, see the [docs](https://developer.gocardless.com/bank-account-data/quick-start-guide).\n\nBefore starting to use API you will need to create a new secret and get your `SECRET_ID` and `SECRET_KEY` from the [GoCardless Bank Account Data Portal](https://bankaccountdata.gocardless.com/user-secrets/).\n\n## Requirements\n\n* Python >= 3.8\n\n\n## Installation\n\nInstall library via pip package manager:\n\n```\npip install nordigen\n```\n\n## Example application\n\nExample code can be found in `main.py` file and Flask application can be found in the `example` directory\n\n## Quickstart\n\n\n```python\nfrom uuid import uuid4\n\nfrom nordigen import NordigenClient\n\n# initialize Nordigen client and pass SECRET_ID and SECRET_KEY\nclient = NordigenClient(\n secret_id=\"SECRET_ID\",\n secret_key=\"SECRET_KEY\"\n)\n\n# Create new access and refresh token\n# Parameters can be loaded from .env or passed as a string\n# Note: access_token is automatically injected to other requests after you successfully obtain it\ntoken_data = client.generate_token()\n\n# Use existing token\nclient.token = \"YOUR_TOKEN\"\n\n# Exchange refresh token for new access token\nnew_token = client.exchange_token(token_data[\"refresh\"])\n\n# Get institution id by bank name and country\ninstitution_id = client.institution.get_institution_id_by_name(\n country=\"LV\",\n institution=\"Revolut\"\n)\n\n# Get all institution by providing country code in ISO 3166 format\ninstitutions = client.institution.get_institutions(\"LV\")\n\n# Initialize bank session\ninit = client.initialize_session(\n # institution id\n institution_id=institution_id,\n # redirect url after successful authentication\n redirect_uri=\"https://gocardless.com\",\n # additional layer of unique ID defined by you\n reference_id=str(uuid4())\n)\n\n# Get requisition_id and link to initiate authorization process with a bank\nlink = init.link # bank authorization link\nrequisition_id = init.requisition_id\n```\n\nAfter successful authorization with a bank you can fetch your data (details, balances, transactions)\n\n---\n\n## Fetching account metadata, balances, details and transactions\n\n```python\n\n# Get account id after you have completed authorization with a bank\n# requisition_id can be gathered from initialize_session response\naccounts = client.requisition.get_requisition_by_id(\n requisition_id=init.requisition_id\n)\n\n# Get account id from the list.\naccount_id = accounts[\"accounts\"][0]\n\n# Create account instance and provide your account id from previous step\naccount = client.account_api(id=account_id)\n\n# Fetch account metadata\nmeta_data = account.get_metadata()\n# Fetch details\ndetails = account.get_details()\n# Fetch balances\nbalances = account.get_balances()\n# Fetch transactions\ntransactions = account.get_transactions()\n# Filter transactions by specific date range\ntransactions = account.get_transactions(date_from=\"2021-12-01\", date_to=\"2022-01-21\")\n```\n\n## Premium endpoints\n\n```python\n# Get premium transactions. Country and date parameters are optional\npremium_transactions = account.get_premium_transactions(\n country=\"LV\",\n date_from=\"2021-12-01\",\n date_to=\"2022-01-21\"\n)\n# Get premium details\npremium_details = account.get_premium_details()\n```\n\n## Support\n\nFor any inquiries please contact support at [bank-account-data-support@gocardless.com](bank-account-data-support@gocardless.com) or create an issue in repository.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python client for GoCardless Bank Account Data API",
"version": "1.4.1",
"project_urls": {
"Homepage": "https://github.com/nordigen/nordigen-python",
"Repository": "https://github.com/nordigen/nordigen-python"
},
"split_keywords": [
"gocardless",
" nordigen",
" nordigen api",
" openbanking"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "524dc28a5eb44e4eebadce7422a0336adc91243d5982666c02d610ff71d4106e",
"md5": "63ae61eaa4395d59ba48113f31efdcfe",
"sha256": "2ac0cd25c969e633f42e4f1b7e4bd4e14f255ba3de9dd6149994226c18cfca2f"
},
"downloads": -1,
"filename": "nordigen-1.4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "63ae61eaa4395d59ba48113f31efdcfe",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 14507,
"upload_time": "2024-10-23T08:31:00",
"upload_time_iso_8601": "2024-10-23T08:31:00.405859Z",
"url": "https://files.pythonhosted.org/packages/52/4d/c28a5eb44e4eebadce7422a0336adc91243d5982666c02d610ff71d4106e/nordigen-1.4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e57e1d42c627e2c918ec2b1f6890915d27896a91d6abfd22d1d32125bd9cd7dc",
"md5": "46f33981b84ab9ca6aaf6bdffed971d7",
"sha256": "cbdc64e4de44448c251fda7b33ad3a68f36d39d7481ac0b2ea34b75b4e05d145"
},
"downloads": -1,
"filename": "nordigen-1.4.1.tar.gz",
"has_sig": false,
"md5_digest": "46f33981b84ab9ca6aaf6bdffed971d7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 16970,
"upload_time": "2024-10-23T08:31:03",
"upload_time_iso_8601": "2024-10-23T08:31:03.494813Z",
"url": "https://files.pythonhosted.org/packages/e5/7e/1d42c627e2c918ec2b1f6890915d27896a91d6abfd22d1d32125bd9cd7dc/nordigen-1.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-23 08:31:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nordigen",
"github_project": "nordigen-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "nordigen"
}