beancount-gocardless 0.1.8__tar.gz → 0.1.10__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.
- beancount_gocardless-0.1.10/.github/workflows/publish.yml +39 -0
- beancount_gocardless-0.1.10/.gitignore +182 -0
- beancount_gocardless-0.1.10/.pre-commit-config.yaml +13 -0
- beancount_gocardless-0.1.10/.readthedocs.yaml +15 -0
- beancount_gocardless-0.1.10/LICENSE +24 -0
- beancount_gocardless-0.1.10/PKG-INFO +130 -0
- beancount_gocardless-0.1.10/README.md +103 -0
- beancount_gocardless-0.1.10/docs/Makefile +20 -0
- beancount_gocardless-0.1.10/docs/cli.rst +43 -0
- beancount_gocardless-0.1.10/docs/client.rst +43 -0
- beancount_gocardless-0.1.10/docs/conf.py +69 -0
- beancount_gocardless-0.1.10/docs/importer.rst +88 -0
- beancount_gocardless-0.1.10/docs/index.rst +77 -0
- beancount_gocardless-0.1.10/docs/make.bat +35 -0
- beancount_gocardless-0.1.10/pyproject.toml +43 -0
- beancount_gocardless-0.1.10/src/beancount_gocardless/__init__.py +9 -0
- beancount_gocardless-0.1.10/src/beancount_gocardless/cli.py +94 -0
- beancount_gocardless-0.1.10/src/beancount_gocardless/client.py +424 -0
- beancount_gocardless-0.1.10/src/beancount_gocardless/importer.py +464 -0
- beancount_gocardless-0.1.10/src/beancount_gocardless/models.py +561 -0
- beancount_gocardless-0.1.10/src/beancount_gocardless/openapi/swagger.json +5344 -0
- beancount_gocardless-0.1.10/src/beancount_gocardless/tui.py +789 -0
- beancount_gocardless-0.1.10/tests/__init__.py +0 -0
- beancount_gocardless-0.1.10/tests/test_tui.py +85 -0
- beancount_gocardless-0.1.8/LICENSE +0 -19
- beancount_gocardless-0.1.8/PKG-INFO +0 -92
- beancount_gocardless-0.1.8/README.md +0 -74
- beancount_gocardless-0.1.8/pyproject.toml +0 -37
- beancount_gocardless-0.1.8/src/beancount_gocardless/__init__.py +0 -2
- beancount_gocardless-0.1.8/src/beancount_gocardless/cli.py +0 -82
- beancount_gocardless-0.1.8/src/beancount_gocardless/client.py +0 -427
- beancount_gocardless-0.1.8/src/beancount_gocardless/importer.py +0 -339
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Upload Python Package to PyPI when a Release is Created
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [created]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
pypi-publish:
|
|
9
|
+
name: Publish release to PyPI
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
environment:
|
|
12
|
+
name: pypi
|
|
13
|
+
url: https://pypi.org/p/beancount-gocardless
|
|
14
|
+
permissions:
|
|
15
|
+
id-token: write
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- name: Install uv
|
|
19
|
+
uses: astral-sh/setup-uv@v4
|
|
20
|
+
with:
|
|
21
|
+
version: "latest"
|
|
22
|
+
- name: Set up Python
|
|
23
|
+
uses: actions/setup-python@v4
|
|
24
|
+
with:
|
|
25
|
+
python-version: "3.12"
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: uv sync --extra dev
|
|
28
|
+
- name: Build package
|
|
29
|
+
run: uv build
|
|
30
|
+
- name: Publish package to PyPI
|
|
31
|
+
run: uv publish --token ${{ secrets.PYPI_API_TOKEN }}
|
|
32
|
+
- name: Build Sphinx documentation
|
|
33
|
+
run: |
|
|
34
|
+
uv run sphinx-build -b html docs/ docs/_build
|
|
35
|
+
- name: Upload documentation artifact
|
|
36
|
+
uses: actions/upload-artifact@v4
|
|
37
|
+
with:
|
|
38
|
+
name: sphinx-docs
|
|
39
|
+
path: docs/_build
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
|
|
110
|
+
# pdm
|
|
111
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
112
|
+
#pdm.lock
|
|
113
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
114
|
+
# in version control.
|
|
115
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
116
|
+
.pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
121
|
+
__pypackages__/
|
|
122
|
+
|
|
123
|
+
# Celery stuff
|
|
124
|
+
celerybeat-schedule
|
|
125
|
+
celerybeat.pid
|
|
126
|
+
|
|
127
|
+
# SageMath parsed files
|
|
128
|
+
*.sage.py
|
|
129
|
+
|
|
130
|
+
# Environments
|
|
131
|
+
.env
|
|
132
|
+
.venv
|
|
133
|
+
env/
|
|
134
|
+
venv/
|
|
135
|
+
ENV/
|
|
136
|
+
env.bak/
|
|
137
|
+
venv.bak/
|
|
138
|
+
|
|
139
|
+
# Spyder project settings
|
|
140
|
+
.spyderproject
|
|
141
|
+
.spyproject
|
|
142
|
+
|
|
143
|
+
# Rope project settings
|
|
144
|
+
.ropeproject
|
|
145
|
+
|
|
146
|
+
# mkdocs documentation
|
|
147
|
+
/site
|
|
148
|
+
|
|
149
|
+
# mypy
|
|
150
|
+
.mypy_cache/
|
|
151
|
+
.dmypy.json
|
|
152
|
+
dmypy.json
|
|
153
|
+
|
|
154
|
+
# Pyre type checker
|
|
155
|
+
.pyre/⚠️
|
|
156
|
+
|
|
157
|
+
# pytype static type analyzer
|
|
158
|
+
.pytype/
|
|
159
|
+
|
|
160
|
+
# Cython debug symbols
|
|
161
|
+
cython_debug/
|
|
162
|
+
|
|
163
|
+
# PyCharm
|
|
164
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
165
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
166
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
167
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
168
|
+
#.idea/
|
|
169
|
+
|
|
170
|
+
# Ruff stuff:
|
|
171
|
+
.ruff_cache/
|
|
172
|
+
|
|
173
|
+
# PyPI configuration file
|
|
174
|
+
.pypirc
|
|
175
|
+
**/.DS_Store
|
|
176
|
+
|
|
177
|
+
# GoCardless cache files and temp data
|
|
178
|
+
*.sqlite
|
|
179
|
+
*.bean
|
|
180
|
+
|
|
181
|
+
# API spec files (regenerate from swagger.json)
|
|
182
|
+
openapi.yaml
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
3
|
+
rev: v0.9.8
|
|
4
|
+
hooks:
|
|
5
|
+
- id: ruff-format
|
|
6
|
+
|
|
7
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
8
|
+
rev: v4.5.0
|
|
9
|
+
hooks:
|
|
10
|
+
- id: trailing-whitespace
|
|
11
|
+
- id: end-of-file-fixer
|
|
12
|
+
- id: check-yaml
|
|
13
|
+
- id: check-added-large-files
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
|
|
3
|
+
build:
|
|
4
|
+
os: ubuntu-22.04
|
|
5
|
+
tools:
|
|
6
|
+
python: "3.12"
|
|
7
|
+
jobs:
|
|
8
|
+
post_create_environment:
|
|
9
|
+
- python -m pip install poetry
|
|
10
|
+
post_install:
|
|
11
|
+
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with dev
|
|
12
|
+
|
|
13
|
+
sphinx:
|
|
14
|
+
configuration: docs/conf.py
|
|
15
|
+
builder: dirhtml
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
This is free and unencumbered software released into the public domain.
|
|
2
|
+
|
|
3
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
4
|
+
distribute this software, either in source code form or as a compiled
|
|
5
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
6
|
+
means.
|
|
7
|
+
|
|
8
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
9
|
+
of this software dedicate any and all copyright interest in the
|
|
10
|
+
software to the public domain. We make this dedication for the benefit
|
|
11
|
+
of the public at large and to the detriment of our heirs and
|
|
12
|
+
successors. We intend this dedication to be an overt act of
|
|
13
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
14
|
+
software under copyright law.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
20
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
21
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
|
|
24
|
+
For more information, please refer to <https://unlicense.org>
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: beancount-gocardless
|
|
3
|
+
Version: 0.1.10
|
|
4
|
+
License-Expression: Unlicense
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Python: <4,>=3.12
|
|
7
|
+
Requires-Dist: beancount
|
|
8
|
+
Requires-Dist: beangulp
|
|
9
|
+
Requires-Dist: pre-commit>=4.5.1
|
|
10
|
+
Requires-Dist: pydantic>=2.0.0
|
|
11
|
+
Requires-Dist: pyyaml
|
|
12
|
+
Requires-Dist: requests
|
|
13
|
+
Requires-Dist: requests-cache
|
|
14
|
+
Requires-Dist: rich
|
|
15
|
+
Requires-Dist: textual-dev>=1.7.0
|
|
16
|
+
Requires-Dist: textual>=3.2.0
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: myst-parser; extra == 'dev'
|
|
19
|
+
Requires-Dist: sphinx; extra == 'dev'
|
|
20
|
+
Requires-Dist: sphinx-rtd-theme; extra == 'dev'
|
|
21
|
+
Provides-Extra: lint
|
|
22
|
+
Requires-Dist: ruff>=0.9.8; extra == 'lint'
|
|
23
|
+
Provides-Extra: test
|
|
24
|
+
Requires-Dist: pytest; extra == 'test'
|
|
25
|
+
Requires-Dist: pytest-asyncio; extra == 'test'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
beancount-gocardless
|
|
29
|
+
====================
|
|
30
|
+
|
|
31
|
+
GoCardless API client with models manually recreated from swagger spec, plus Beancount importer.
|
|
32
|
+
|
|
33
|
+
Inspired by https://github.com/tarioch/beancounttools.
|
|
34
|
+
|
|
35
|
+
Full documentation at https://beancount-gocardless.readthedocs.io/en/latest/.
|
|
36
|
+
|
|
37
|
+
**Key Features:**
|
|
38
|
+
|
|
39
|
+
- **API Client:** Models based on swagger spec. Built-in caching via `requests-cache`.
|
|
40
|
+
- **GoCardLess CLI**\: A command-line interface to manage authorization with the GoCardless API:
|
|
41
|
+
|
|
42
|
+
- Listing available banks in a specified country (default: GB).
|
|
43
|
+
- Creating a link to a specific bank using its ID.
|
|
44
|
+
- Listing authorized accounts.
|
|
45
|
+
- Deleting an existing link.
|
|
46
|
+
- Uses environment variables (`GOCARDLESS_SECRET_ID`, `GOCARDLESS_SECRET_KEY`) or command-line arguments for API credentials.
|
|
47
|
+
- **Beancount Importer:** A `beangulp.Importer` implementation to easily import transactions fetched from the GoCardless API directly into your Beancount ledger.
|
|
48
|
+
|
|
49
|
+
You'll need to create a GoCardLess account on https://bankaccountdata.gocardless.com/overview/ to get your credentials.
|
|
50
|
+
|
|
51
|
+
## Development
|
|
52
|
+
|
|
53
|
+
### API Coverage
|
|
54
|
+
|
|
55
|
+
The GoCardless client provides **complete API coverage** with Pydantic models for all endpoints and data structures:
|
|
56
|
+
|
|
57
|
+
**🏦 Core Banking:**
|
|
58
|
+
- **Accounts**: Full account metadata, balances, details, and transactions
|
|
59
|
+
- **Institutions**: Bank/institution information and capabilities
|
|
60
|
+
- **Requisitions**: Bank link management with full lifecycle support
|
|
61
|
+
|
|
62
|
+
**📋 Agreements & Permissions:**
|
|
63
|
+
- **End User Agreements**: Complete agreement lifecycle management
|
|
64
|
+
- **Access Scopes**: Granular permission control
|
|
65
|
+
- **Reconfirmations**: Agreement renewal workflows
|
|
66
|
+
|
|
67
|
+
**🔧 Advanced Features:**
|
|
68
|
+
- **Integrations**: Institution capability discovery
|
|
69
|
+
- **Token Management**: JWT token handling (internal)
|
|
70
|
+
- **Pagination**: Full paginated response support
|
|
71
|
+
- **Error Handling**: Error response models
|
|
72
|
+
|
|
73
|
+
**📊 Rich Data Models:**
|
|
74
|
+
- **Transactions**: Complete transaction details with currency exchange, balances, and metadata
|
|
75
|
+
- **Balances**: Multi-currency balance information with transaction impact
|
|
76
|
+
- **Account Details**: Extensive account information including ownership and addresses
|
|
77
|
+
|
|
78
|
+
Models manually recreated from the swagger spec, providing type-safe access to every API feature.
|
|
79
|
+
|
|
80
|
+
**Installation:**
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pip install beancount-gocardless
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Usage**
|
|
87
|
+
```yaml
|
|
88
|
+
#### gocardless.yaml
|
|
89
|
+
secret_id: $GOCARDLESS_SECRET_ID
|
|
90
|
+
secret_key: $GOCARDLESS_SECRET_KEY
|
|
91
|
+
|
|
92
|
+
cache_options: # by default, no caching if cache_options is not provided
|
|
93
|
+
cache_name: "gocardless"
|
|
94
|
+
backend: "sqlite"
|
|
95
|
+
expire_after: 3600
|
|
96
|
+
old_data_on_error: true
|
|
97
|
+
|
|
98
|
+
accounts:
|
|
99
|
+
- id: <REDACTED_UUID>
|
|
100
|
+
asset_account: "Assets:Banks:Revolut:Checking"
|
|
101
|
+
transaction_types: ["booked", "pending"] # optional, defaults to both
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
#### my.import
|
|
106
|
+
#!/usr/bin/env python
|
|
107
|
+
|
|
108
|
+
import beangulp
|
|
109
|
+
from beancount_gocardless import GoCardLessImporter
|
|
110
|
+
from smart_importer import apply_hooks, PredictPostings, PredictPayees
|
|
111
|
+
|
|
112
|
+
importers = [
|
|
113
|
+
apply_hooks(
|
|
114
|
+
GoCardLessImporter(),
|
|
115
|
+
[
|
|
116
|
+
PredictPostings(),
|
|
117
|
+
PredictPayees(),
|
|
118
|
+
],
|
|
119
|
+
)
|
|
120
|
+
]
|
|
121
|
+
|
|
122
|
+
if __name__ == "__main__":
|
|
123
|
+
ingest = beangulp.Ingest(importers)
|
|
124
|
+
ingest()
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Import your data from GoCardLess's API
|
|
128
|
+
```bash
|
|
129
|
+
python my.import extract ./gocardless.yaml --existing ./ledger.bean
|
|
130
|
+
```
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
beancount-gocardless
|
|
2
|
+
====================
|
|
3
|
+
|
|
4
|
+
GoCardless API client with models manually recreated from swagger spec, plus Beancount importer.
|
|
5
|
+
|
|
6
|
+
Inspired by https://github.com/tarioch/beancounttools.
|
|
7
|
+
|
|
8
|
+
Full documentation at https://beancount-gocardless.readthedocs.io/en/latest/.
|
|
9
|
+
|
|
10
|
+
**Key Features:**
|
|
11
|
+
|
|
12
|
+
- **API Client:** Models based on swagger spec. Built-in caching via `requests-cache`.
|
|
13
|
+
- **GoCardLess CLI**\: A command-line interface to manage authorization with the GoCardless API:
|
|
14
|
+
|
|
15
|
+
- Listing available banks in a specified country (default: GB).
|
|
16
|
+
- Creating a link to a specific bank using its ID.
|
|
17
|
+
- Listing authorized accounts.
|
|
18
|
+
- Deleting an existing link.
|
|
19
|
+
- Uses environment variables (`GOCARDLESS_SECRET_ID`, `GOCARDLESS_SECRET_KEY`) or command-line arguments for API credentials.
|
|
20
|
+
- **Beancount Importer:** A `beangulp.Importer` implementation to easily import transactions fetched from the GoCardless API directly into your Beancount ledger.
|
|
21
|
+
|
|
22
|
+
You'll need to create a GoCardLess account on https://bankaccountdata.gocardless.com/overview/ to get your credentials.
|
|
23
|
+
|
|
24
|
+
## Development
|
|
25
|
+
|
|
26
|
+
### API Coverage
|
|
27
|
+
|
|
28
|
+
The GoCardless client provides **complete API coverage** with Pydantic models for all endpoints and data structures:
|
|
29
|
+
|
|
30
|
+
**🏦 Core Banking:**
|
|
31
|
+
- **Accounts**: Full account metadata, balances, details, and transactions
|
|
32
|
+
- **Institutions**: Bank/institution information and capabilities
|
|
33
|
+
- **Requisitions**: Bank link management with full lifecycle support
|
|
34
|
+
|
|
35
|
+
**📋 Agreements & Permissions:**
|
|
36
|
+
- **End User Agreements**: Complete agreement lifecycle management
|
|
37
|
+
- **Access Scopes**: Granular permission control
|
|
38
|
+
- **Reconfirmations**: Agreement renewal workflows
|
|
39
|
+
|
|
40
|
+
**🔧 Advanced Features:**
|
|
41
|
+
- **Integrations**: Institution capability discovery
|
|
42
|
+
- **Token Management**: JWT token handling (internal)
|
|
43
|
+
- **Pagination**: Full paginated response support
|
|
44
|
+
- **Error Handling**: Error response models
|
|
45
|
+
|
|
46
|
+
**📊 Rich Data Models:**
|
|
47
|
+
- **Transactions**: Complete transaction details with currency exchange, balances, and metadata
|
|
48
|
+
- **Balances**: Multi-currency balance information with transaction impact
|
|
49
|
+
- **Account Details**: Extensive account information including ownership and addresses
|
|
50
|
+
|
|
51
|
+
Models manually recreated from the swagger spec, providing type-safe access to every API feature.
|
|
52
|
+
|
|
53
|
+
**Installation:**
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install beancount-gocardless
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Usage**
|
|
60
|
+
```yaml
|
|
61
|
+
#### gocardless.yaml
|
|
62
|
+
secret_id: $GOCARDLESS_SECRET_ID
|
|
63
|
+
secret_key: $GOCARDLESS_SECRET_KEY
|
|
64
|
+
|
|
65
|
+
cache_options: # by default, no caching if cache_options is not provided
|
|
66
|
+
cache_name: "gocardless"
|
|
67
|
+
backend: "sqlite"
|
|
68
|
+
expire_after: 3600
|
|
69
|
+
old_data_on_error: true
|
|
70
|
+
|
|
71
|
+
accounts:
|
|
72
|
+
- id: <REDACTED_UUID>
|
|
73
|
+
asset_account: "Assets:Banks:Revolut:Checking"
|
|
74
|
+
transaction_types: ["booked", "pending"] # optional, defaults to both
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
#### my.import
|
|
79
|
+
#!/usr/bin/env python
|
|
80
|
+
|
|
81
|
+
import beangulp
|
|
82
|
+
from beancount_gocardless import GoCardLessImporter
|
|
83
|
+
from smart_importer import apply_hooks, PredictPostings, PredictPayees
|
|
84
|
+
|
|
85
|
+
importers = [
|
|
86
|
+
apply_hooks(
|
|
87
|
+
GoCardLessImporter(),
|
|
88
|
+
[
|
|
89
|
+
PredictPostings(),
|
|
90
|
+
PredictPayees(),
|
|
91
|
+
],
|
|
92
|
+
)
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
if __name__ == "__main__":
|
|
96
|
+
ingest = beangulp.Ingest(importers)
|
|
97
|
+
ingest()
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Import your data from GoCardLess's API
|
|
101
|
+
```bash
|
|
102
|
+
python my.import extract ./gocardless.yaml --existing ./ledger.bean
|
|
103
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = .
|
|
9
|
+
BUILDDIR = _build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
GoCardless CLI
|
|
2
|
+
===============
|
|
3
|
+
|
|
4
|
+
Commands: list banks, create/delete links, list accounts, check balances. Uses GoCardlessClient. Args or env vars.
|
|
5
|
+
|
|
6
|
+
Usage
|
|
7
|
+
-----
|
|
8
|
+
|
|
9
|
+
.. code-block:: console
|
|
10
|
+
|
|
11
|
+
beancount-gocardless <mode> [options]
|
|
12
|
+
|
|
13
|
+
Modes
|
|
14
|
+
-----
|
|
15
|
+
|
|
16
|
+
- list_banks: Banks by country
|
|
17
|
+
- create_link: Create bank link
|
|
18
|
+
- list_accounts: Connected accounts
|
|
19
|
+
- delete_link: Delete link
|
|
20
|
+
- balance: Account balance
|
|
21
|
+
|
|
22
|
+
Options
|
|
23
|
+
-------
|
|
24
|
+
|
|
25
|
+
- --secret_id: Secret ID (env: GOCARDLESS_SECRET_ID)
|
|
26
|
+
- --secret_key: Secret key (env: GOCARDLESS_SECRET_KEY)
|
|
27
|
+
- --country: Country code, default "GB" (list_banks)
|
|
28
|
+
- --reference: Reference, default "beancount" (create_link/delete_link)
|
|
29
|
+
- --bank: Bank ID (create_link)
|
|
30
|
+
- --account: Account ID (balance)
|
|
31
|
+
- --cache: Enable caching
|
|
32
|
+
- --cache_backend: Backend, default "sqlite"
|
|
33
|
+
- --cache_expire: Expiry secs, default 0
|
|
34
|
+
- --cache_name: Name, default "gocardless"
|
|
35
|
+
|
|
36
|
+
Examples
|
|
37
|
+
--------
|
|
38
|
+
|
|
39
|
+
- List UK banks: beancount-gocardless list_banks --country GB
|
|
40
|
+
- Create link: beancount-gocardless create_link --bank MY_BANK_ID --reference myref
|
|
41
|
+
- List accounts: beancount-gocardless list_accounts
|
|
42
|
+
- Delete link: beancount-gocardless delete_link --reference myref
|
|
43
|
+
- Check balance: beancount-gocardless balance --account MY_ACCOUNT_ID
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
GoCardless Client
|
|
2
|
+
=================
|
|
3
|
+
|
|
4
|
+
Auto-generated from swagger.json. Typed with Pydantic. Full caching support. Header stripping. Token refresh. Cache status check.
|
|
5
|
+
|
|
6
|
+
Features
|
|
7
|
+
--------
|
|
8
|
+
|
|
9
|
+
- Typed responses via Pydantic models
|
|
10
|
+
- Convenience methods: list_banks(), create_bank_link(), get_all_accounts()
|
|
11
|
+
- All 14 API endpoints
|
|
12
|
+
- Error handling with token refresh
|
|
13
|
+
- Caching: sqlite, configurable expiry
|
|
14
|
+
- Header stripping for privacy
|
|
15
|
+
- Cache debugging via check_cache_status()
|
|
16
|
+
|
|
17
|
+
Usage
|
|
18
|
+
-----
|
|
19
|
+
|
|
20
|
+
.. code-block:: python
|
|
21
|
+
|
|
22
|
+
from beancount_gocardless import GoCardlessClient
|
|
23
|
+
|
|
24
|
+
client = GoCardlessClient("secret_id", "secret_key", cache_options={
|
|
25
|
+
"cache_name": "my_cache",
|
|
26
|
+
"expire_after": 3600
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
banks = client.list_banks("GB")
|
|
30
|
+
accounts = client.get_all_accounts()
|
|
31
|
+
|
|
32
|
+
CLI
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
.. code-block:: bash
|
|
36
|
+
|
|
37
|
+
beancount-gocardless list_banks --country GB --cache --cache_expire 3600
|
|
38
|
+
beancount-gocardless create_link --reference mybank --bank SANDBOXFINANCE_SFIN0000 --cache
|
|
39
|
+
|
|
40
|
+
Regeneration
|
|
41
|
+
------------
|
|
42
|
+
|
|
43
|
+
Update API: cd openapi; ./regen_simple_client.sh
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
sys.path.insert(0, os.path.abspath("../src")) # Correct path to your source
|
|
5
|
+
|
|
6
|
+
print()
|
|
7
|
+
|
|
8
|
+
# Configuration file for the Sphinx documentation builder.
|
|
9
|
+
#
|
|
10
|
+
# For the full list of built-in configuration values, see the documentation:
|
|
11
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
12
|
+
|
|
13
|
+
# -- Project information -----------------------------------------------------
|
|
14
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
15
|
+
|
|
16
|
+
project = "beancount-gocardless"
|
|
17
|
+
copyright = "2025, forgx1"
|
|
18
|
+
author = "forgx1"
|
|
19
|
+
release = "0.1.0"
|
|
20
|
+
|
|
21
|
+
# -- General configuration ---------------------------------------------------
|
|
22
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
23
|
+
|
|
24
|
+
extensions = [
|
|
25
|
+
"myst_parser",
|
|
26
|
+
"sphinx.ext.autodoc",
|
|
27
|
+
"sphinx.ext.napoleon",
|
|
28
|
+
"sphinx.ext.viewcode",
|
|
29
|
+
"sphinx.ext.autodoc.typehints",
|
|
30
|
+
]
|
|
31
|
+
# Add this to enable Markdown in docstrings:
|
|
32
|
+
autodoc_mock_imports = ["requests", "requests-cache", "beancount", "beangulp", "pyyaml"]
|
|
33
|
+
autodoc_default_options = {
|
|
34
|
+
"members": True,
|
|
35
|
+
"undoc-members": True,
|
|
36
|
+
"show-inheritance": True,
|
|
37
|
+
"special-members": "__init__",
|
|
38
|
+
}
|
|
39
|
+
autodoc_typehints = "description"
|
|
40
|
+
|
|
41
|
+
# Napoleon settings for Google and NumPy style docstrings
|
|
42
|
+
napoleon_google_docstring = True
|
|
43
|
+
napoleon_numpy_docstring = True
|
|
44
|
+
napoleon_use_param = True
|
|
45
|
+
napoleon_use_rtype = True
|
|
46
|
+
napoleon_use_ivar = True
|
|
47
|
+
templates_path = ["_templates"]
|
|
48
|
+
|
|
49
|
+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
|
50
|
+
|
|
51
|
+
# Enable proper parsing of markdown in docstrings
|
|
52
|
+
source_suffix = {
|
|
53
|
+
".rst": "restructuredtext",
|
|
54
|
+
".md": "markdown",
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
# MyST parser settings for markdown support
|
|
58
|
+
myst_parse_docstrings = True
|
|
59
|
+
myst_enable_extensions = [
|
|
60
|
+
"colon_fence",
|
|
61
|
+
"deflist",
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# -- Options for HTML output -------------------------------------------------
|
|
66
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
67
|
+
|
|
68
|
+
html_theme = "sphinx_rtd_theme"
|
|
69
|
+
html_static_path = ["_static"]
|