beancount-gocardless 0.1.1__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,92 @@
1
+ Metadata-Version: 2.3
2
+ Name: beancount-gocardless
3
+ Version: 0.1.2
4
+ Summary:
5
+ License: MIT
6
+ Requires-Python: >=3.12
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Classifier: Programming Language :: Python :: 3.13
11
+ Requires-Dist: beancount
12
+ Requires-Dist: beangulp
13
+ Requires-Dist: pyyaml
14
+ Requires-Dist: requests
15
+ Requires-Dist: requests-cache
16
+ Description-Content-Type: text/markdown
17
+
18
+ beancount-gocardless
19
+ ====================
20
+
21
+ This package provides a basic client for interacting with the GoCardless API (formerly Nordigen) and importing your data into Beancount.
22
+
23
+ This project was inspired by https://github.com/tarioch/beancounttools
24
+
25
+ Full documentation available at https://beancount-gocardless.readthedocs.io/en/latest/
26
+
27
+
28
+ **Key Features:**
29
+
30
+ - **GoCardless API Client:** A client for interacting with the GoCardless API. The client has built-in caching via `requests-cache`.
31
+ - **GoCardLess CLI**\: A command-line interface to manage authorization with the GoCardless API:
32
+
33
+ - Listing available banks in a specified country (default: GB).
34
+ - Creating a link to a specific bank using its ID.
35
+ - Listing authorized accounts.
36
+ - Deleting an existing link.
37
+ - Uses environment variables (`NORDIGEN_SECRET_ID`, `NORDIGEN_SECRET_KEY`) or command-line arguments for API credentials.
38
+ - **Beancount Importer:** A `beangulp.Importer` implementation to easily import transactions fetched from the GoCardless API directly into your Beancount ledger.
39
+
40
+ You'll need to create a GoCardLess account on https://bankaccountdata.gocardless.com/overview/ to get your credentials.
41
+
42
+ **Installation:**
43
+
44
+ ```bash
45
+ pip install beancount-gocardless
46
+ ```
47
+
48
+ **Usage**
49
+ ```yaml
50
+ #### nordigen.yaml
51
+ secret_id: $NORDIGEN_SECRET_ID
52
+ secret_key: $NORDIGEN_SECRET_KEY
53
+
54
+ cache_options: # by default, no caching if cache_options is not provided
55
+ cache_name: "nordigen"
56
+ backend: "sqlite"
57
+ expire_after: 3600
58
+ old_data_on_error: true
59
+
60
+ accounts:
61
+ - id: <REDACTED_UUID>
62
+ asset_account: "Assets:Banks:Revolut:Checking"
63
+ ```
64
+
65
+ ```python
66
+ #### my.import
67
+ #!/usr/bin/env python
68
+
69
+ import beangulp
70
+ from beancount_gocardless import NordigenImporter
71
+ from smart_importer import apply_hooks, PredictPostings, PredictPayees
72
+
73
+ importers = [
74
+ apply_hooks(
75
+ NordigenImporter(),
76
+ [
77
+ PredictPostings(),
78
+ PredictPayees(),
79
+ ],
80
+ )
81
+ ]
82
+
83
+ if __name__ == "__main__":
84
+ ingest = beangulp.Ingest(importers)
85
+ ingest()
86
+ ```
87
+
88
+ Import your data from Nordigen's API
89
+ ```bash
90
+ python my.import extract ./nordigen.yaml --existing ./ledger.bean
91
+ ```
92
+
@@ -0,0 +1,74 @@
1
+ beancount-gocardless
2
+ ====================
3
+
4
+ This package provides a basic client for interacting with the GoCardless API (formerly Nordigen) and importing your data into Beancount.
5
+
6
+ This project was inspired by https://github.com/tarioch/beancounttools
7
+
8
+ Full documentation available at https://beancount-gocardless.readthedocs.io/en/latest/
9
+
10
+
11
+ **Key Features:**
12
+
13
+ - **GoCardless API Client:** A client for interacting with the GoCardless API. The client has built-in caching via `requests-cache`.
14
+ - **GoCardLess CLI**\: A command-line interface to manage authorization with the GoCardless API:
15
+
16
+ - Listing available banks in a specified country (default: GB).
17
+ - Creating a link to a specific bank using its ID.
18
+ - Listing authorized accounts.
19
+ - Deleting an existing link.
20
+ - Uses environment variables (`NORDIGEN_SECRET_ID`, `NORDIGEN_SECRET_KEY`) or command-line arguments for API credentials.
21
+ - **Beancount Importer:** A `beangulp.Importer` implementation to easily import transactions fetched from the GoCardless API directly into your Beancount ledger.
22
+
23
+ You'll need to create a GoCardLess account on https://bankaccountdata.gocardless.com/overview/ to get your credentials.
24
+
25
+ **Installation:**
26
+
27
+ ```bash
28
+ pip install beancount-gocardless
29
+ ```
30
+
31
+ **Usage**
32
+ ```yaml
33
+ #### nordigen.yaml
34
+ secret_id: $NORDIGEN_SECRET_ID
35
+ secret_key: $NORDIGEN_SECRET_KEY
36
+
37
+ cache_options: # by default, no caching if cache_options is not provided
38
+ cache_name: "nordigen"
39
+ backend: "sqlite"
40
+ expire_after: 3600
41
+ old_data_on_error: true
42
+
43
+ accounts:
44
+ - id: <REDACTED_UUID>
45
+ asset_account: "Assets:Banks:Revolut:Checking"
46
+ ```
47
+
48
+ ```python
49
+ #### my.import
50
+ #!/usr/bin/env python
51
+
52
+ import beangulp
53
+ from beancount_gocardless import NordigenImporter
54
+ from smart_importer import apply_hooks, PredictPostings, PredictPayees
55
+
56
+ importers = [
57
+ apply_hooks(
58
+ NordigenImporter(),
59
+ [
60
+ PredictPostings(),
61
+ PredictPayees(),
62
+ ],
63
+ )
64
+ ]
65
+
66
+ if __name__ == "__main__":
67
+ ingest = beangulp.Ingest(importers)
68
+ ingest()
69
+ ```
70
+
71
+ Import your data from Nordigen's API
72
+ ```bash
73
+ python my.import extract ./nordigen.yaml --existing ./ledger.bean
74
+ ```
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "beancount-gocardless"
3
- version = "0.1.1"
3
+ version = "0.1.2"
4
4
  description = ""
5
5
  authors = []
6
6
  readme = "README.md"
@@ -18,18 +18,15 @@ license-files = ["LICENSE"]
18
18
  [tool.poetry]
19
19
  packages = [{include = "beancount_gocardless", from = "src"}]
20
20
 
21
- [tool.uv]
22
- default-groups = ["dev", "lint"]
23
21
 
24
- [dependency-groups]
25
- dev = [
26
- "sphinx",
27
- "sphinx-rtd-theme",
28
- "myst_parser"
29
- ]
30
- lint = [
31
- "ruff>=0.9.8",
32
- ]
22
+ [tool.poetry.group.dev.dependencies]
23
+ sphinx = "*"
24
+ sphinx-rtd-theme = "*"
25
+ myst_parser = "*"
26
+ pre-commit = "*"
27
+
28
+ [tool.poetry.group.lint.dependencies]
29
+ ruff = ">=0.9.8"
33
30
 
34
31
 
35
32
  [build-system]
@@ -0,0 +1,2 @@
1
+ from .client import NordigenClient # noqa: F401
2
+ from .importer import NordigenImporter # noqa: F401
@@ -55,7 +55,7 @@ def main():
55
55
  client = NordigenClient(
56
56
  args.secret_id,
57
57
  args.secret_key,
58
- {"expire_after": 3600 * 24},
58
+ {},
59
59
  )
60
60
 
61
61
  if args.mode == "list_banks":
@@ -1,7 +1,7 @@
1
- from datetime import date, timedelta, datetime
1
+ from datetime import timedelta, datetime
2
2
  import requests_cache
3
3
  import requests
4
- from typing import Protocol, TypedDict, Optional
4
+ from typing import TypedDict, Optional
5
5
 
6
6
 
7
7
  class CacheOptions(TypedDict, total=False):
@@ -54,7 +54,7 @@ class BaseService:
54
54
  DEFAULT_CACHE_OPTIONS: CacheOptions = {
55
55
  "cache_name": "nordigen",
56
56
  "backend": "sqlite",
57
- "expire_after": 3600 * 24,
57
+ "expire_after": 0,
58
58
  "old_data_on_error": False,
59
59
  }
60
60
 
@@ -1,10 +1,10 @@
1
- from datetime import date, timedelta, datetime
1
+ from datetime import date
2
2
  from os import path
3
3
  import beangulp
4
4
  import yaml
5
5
  from beancount.core import amount, data, flags
6
6
  from beancount.core.number import D
7
- from .client import NordigenClient # Assuming client.py is in the same directory
7
+ from .client import NordigenClient
8
8
 
9
9
 
10
10
  class NordigenImporter(beangulp.Importer):
@@ -34,7 +34,7 @@ class NordigenImporter(beangulp.Importer):
34
34
  self._client = NordigenClient(
35
35
  self.config["secret_id"],
36
36
  self.config["secret_key"],
37
- cache_options={"expire_after": 3600 * 24, "old_data_on_error": True},
37
+ cache_options=self.config.get('cache_options', None),
38
38
  )
39
39
 
40
40
  return self._client
@@ -1,37 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: beancount-gocardless
3
- Version: 0.1.1
4
- Summary:
5
- License: MIT
6
- Requires-Python: >=3.12
7
- Classifier: License :: OSI Approved :: MIT License
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.12
10
- Classifier: Programming Language :: Python :: 3.13
11
- Requires-Dist: beancount
12
- Requires-Dist: beangulp
13
- Requires-Dist: pyyaml
14
- Requires-Dist: requests
15
- Requires-Dist: requests-cache
16
- Description-Content-Type: text/markdown
17
-
18
- beancount-gocardless
19
- ====================
20
-
21
- This package provides a basic client for interacting with the GoCardless API (formerly Nordigen), a command-line interface (CLI) tool for authorization, and a Beancount importer for seamless integration with your financial data. It streamlines the process of fetching bank account data via the GoCardless API and incorporating it into your Beancount ledger.
22
-
23
- **Key Features:**
24
-
25
- * **GoCardless API Client:** A client for interacting with the GoCardless API. The client has built-in caching via `requests-cache`, which helps during testing as GoCardLess API limits the number of requests to 4/day/account.
26
- * **GoCardLess CLI:** A command-line interface to manage authorization with the GoCardless API. The CLI supports:
27
- * Listing available banks in a specified country (default: GB).
28
- * Creating a link to a specific bank using its ID.
29
- * Listing authorized accounts.
30
- * Deleting an existing link.
31
- * Uses environment variables (`NORDIGEN_SECRET_ID`, `NORDIGEN_SECRET_KEY`) or command-line arguments for API credentials.
32
- * **Beancount Importer:** A `beangulp.Importer` implementation to easily import transactions fetched from the GoCardless API directly into your Beancount ledger.
33
-
34
- **Installation:**
35
-
36
- ```bash
37
- pip install beancount-gocardless
@@ -1,20 +0,0 @@
1
- beancount-gocardless
2
- ====================
3
-
4
- This package provides a basic client for interacting with the GoCardless API (formerly Nordigen), a command-line interface (CLI) tool for authorization, and a Beancount importer for seamless integration with your financial data. It streamlines the process of fetching bank account data via the GoCardless API and incorporating it into your Beancount ledger.
5
-
6
- **Key Features:**
7
-
8
- * **GoCardless API Client:** A client for interacting with the GoCardless API. The client has built-in caching via `requests-cache`, which helps during testing as GoCardLess API limits the number of requests to 4/day/account.
9
- * **GoCardLess CLI:** A command-line interface to manage authorization with the GoCardless API. The CLI supports:
10
- * Listing available banks in a specified country (default: GB).
11
- * Creating a link to a specific bank using its ID.
12
- * Listing authorized accounts.
13
- * Deleting an existing link.
14
- * Uses environment variables (`NORDIGEN_SECRET_ID`, `NORDIGEN_SECRET_KEY`) or command-line arguments for API credentials.
15
- * **Beancount Importer:** A `beangulp.Importer` implementation to easily import transactions fetched from the GoCardless API directly into your Beancount ledger.
16
-
17
- **Installation:**
18
-
19
- ```bash
20
- pip install beancount-gocardless
@@ -1,2 +0,0 @@
1
- from .client import NordigenClient
2
- from .importer import NordigenImporter