beancount-gocardless 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl

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.
@@ -1,2 +1,2 @@
1
- from .client import NordigenClient
2
- from .importer import NordigenImporter
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
@@ -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,8 @@
1
+ beancount_gocardless/__init__.py,sha256=Rf2-pfuaXaXPwBu3yEn2uXyOQ6uLyGxljJ5hoTCss5Y,100
2
+ beancount_gocardless/cli.py,sha256=ZdsdknScEOlUq_7rI0ixzN1UDh1dgUokzTzO_3WySqY,2407
3
+ beancount_gocardless/client.py,sha256=zjWgagMK9LbV0lDsQ4W-FSxGxoj-KYKKmgOlx2XZsKk,12283
4
+ beancount_gocardless/importer.py,sha256=6VBGkwU2arRukXGkHuKtINGy7ocOmM1NM48l8jLPbTs,11375
5
+ beancount_gocardless-0.1.2.dist-info/LICENSE,sha256=7EI8xVBu6h_7_JlVw-yPhhOZlpY9hP8wal7kHtqKT_E,1074
6
+ beancount_gocardless-0.1.2.dist-info/METADATA,sha256=JbiSAL5dC2fGnHmzqh3HOpuhc4cGNjXov1oUJWaeeD4,2634
7
+ beancount_gocardless-0.1.2.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
8
+ beancount_gocardless-0.1.2.dist-info/RECORD,,
@@ -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,8 +0,0 @@
1
- beancount_gocardless/__init__.py,sha256=-taSw3dkNHhkBQrKeJMKUt-qIitinGevRW4hSqxHp58,73
2
- beancount_gocardless/cli.py,sha256=QK3m9urC0VLwzMMqMT4owlrsKQ6f7feZT7a7bWX79Po,2432
3
- beancount_gocardless/client.py,sha256=lz-vCeca78cig0V5iNk_uUVHlvtE3tBbw1KkcwY6n1U,12307
4
- beancount_gocardless/importer.py,sha256=2UqSAbfa8d2UBZxTewmyyQ7G3Hm1b_4x7VuXWonoa8w,11459
5
- beancount_gocardless-0.1.1.dist-info/LICENSE,sha256=7EI8xVBu6h_7_JlVw-yPhhOZlpY9hP8wal7kHtqKT_E,1074
6
- beancount_gocardless-0.1.1.dist-info/METADATA,sha256=nc5mVlnMwp1MljMyJ-hzmMGfPZ2bGFZa2155fiMsw_4,1798
7
- beancount_gocardless-0.1.1.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
8
- beancount_gocardless-0.1.1.dist-info/RECORD,,