mirror of
https://github.com/elisiariocouto/leggen.git
synced 2025-12-29 09:49:17 +00:00
Compare commits
7 Commits
473f126d3e
...
2025.10.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0205e5be0d | ||
|
|
ca7968cc3c | ||
|
|
e6da6ee9ab | ||
|
|
8802d24789 | ||
|
|
d3954f079b | ||
|
|
0b68038739 | ||
|
|
d36568da54 |
36
CHANGELOG.md
36
CHANGELOG.md
@@ -1,4 +1,40 @@
|
||||
|
||||
## 2025.10.0 (2025/10/01)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **gocardless:** Increase timeout to 30 seconds, some requests take some time. ([ca7968cc](https://github.com/elisiariocouto/leggen/commit/ca7968cc3c625e243fe2d75590a9e56f3100072b))
|
||||
|
||||
|
||||
|
||||
## 2025.9.26 (2025/09/30)
|
||||
|
||||
### Debug
|
||||
|
||||
- Log different sets of GoCardless rate limits. ([8802d247](https://github.com/elisiariocouto/leggen/commit/8802d24789cbb8e854d857a0d7cc89a25a26f378))
|
||||
|
||||
|
||||
|
||||
## 2025.9.25 (2025/09/30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **api:** Fix S3 backup path-style configuration and improve UX. ([22ec0e36](https://github.com/elisiariocouto/leggen/commit/22ec0e36b11e5b017075bee51de0423a53ec4648))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
- **api:** Add S3 backup functionality to backend ([7f2a4634](https://github.com/elisiariocouto/leggen/commit/7f2a4634c51814b6785433a25ce42d20aea0558c))
|
||||
- **frontend:** Add S3 backup UI and complete backup functionality ([01229130](https://github.com/elisiariocouto/leggen/commit/0122913052793bcbf011cb557ef182be21c5de93))
|
||||
- **frontend:** Add ability to list backups and create a backup on demand. ([473f126d](https://github.com/elisiariocouto/leggen/commit/473f126d3e699521172539f2ca0bff0579ccee51))
|
||||
|
||||
|
||||
### Miscellaneous Tasks
|
||||
|
||||
- Log more rate limit headers. ([d36568da](https://github.com/elisiariocouto/leggen/commit/d36568da540d4fb4ae1fa10b322a3fa77dcc5360))
|
||||
|
||||
|
||||
|
||||
## 2025.9.24 (2025/09/25)
|
||||
|
||||
### Features
|
||||
|
||||
@@ -9,16 +9,21 @@ from leggen.utils.config import config
|
||||
from leggen.utils.paths import path_manager
|
||||
|
||||
|
||||
def _log_rate_limits(response):
|
||||
def _log_rate_limits(response, method, url):
|
||||
"""Log GoCardless API rate limit headers"""
|
||||
limit = response.headers.get("http_x_ratelimit_limit")
|
||||
remaining = response.headers.get("http_x_ratelimit_remaining")
|
||||
reset = response.headers.get("http_x_ratelimit_reset")
|
||||
|
||||
if limit or remaining or reset:
|
||||
logger.info(
|
||||
f"GoCardless rate limits - Limit: {limit}, Remaining: {remaining}, Reset: {reset}s"
|
||||
)
|
||||
account_limit = response.headers.get("http_x_ratelimit_account_success_limit")
|
||||
account_remaining = response.headers.get(
|
||||
"http_x_ratelimit_account_success_remaining"
|
||||
)
|
||||
account_reset = response.headers.get("http_x_ratelimit_account_success_reset")
|
||||
|
||||
logger.debug(
|
||||
f"{method} {url} Limit/Remaining/Reset (Global: {limit}/{remaining}/{reset}s) (Account: {account_limit}/{account_remaining}/{account_reset}s)"
|
||||
)
|
||||
|
||||
|
||||
class GoCardlessService:
|
||||
@@ -36,16 +41,20 @@ class GoCardlessService:
|
||||
headers = await self._get_auth_headers()
|
||||
|
||||
async with httpx.AsyncClient() as client:
|
||||
response = await client.request(method, url, headers=headers, **kwargs)
|
||||
_log_rate_limits(response)
|
||||
response = await client.request(
|
||||
method, url, headers=headers, timeout=30, **kwargs
|
||||
)
|
||||
_log_rate_limits(response, method, url)
|
||||
|
||||
# If we get 401, clear token cache and retry once
|
||||
if response.status_code == 401:
|
||||
logger.warning("Got 401, clearing token cache and retrying")
|
||||
self._token = None
|
||||
headers = await self._get_auth_headers()
|
||||
response = await client.request(method, url, headers=headers, **kwargs)
|
||||
_log_rate_limits(response)
|
||||
response = await client.request(
|
||||
method, url, headers=headers, timeout=30, **kwargs
|
||||
)
|
||||
_log_rate_limits(response, method, url)
|
||||
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
@@ -76,7 +85,9 @@ class GoCardlessService:
|
||||
f"{self.base_url}/token/refresh/",
|
||||
json={"refresh": auth["refresh"]},
|
||||
)
|
||||
_log_rate_limits(response)
|
||||
_log_rate_limits(
|
||||
response, "POST", f"{self.base_url}/token/refresh/"
|
||||
)
|
||||
response.raise_for_status()
|
||||
auth.update(response.json())
|
||||
self._save_auth(auth)
|
||||
@@ -104,7 +115,7 @@ class GoCardlessService:
|
||||
"secret_key": self.config["secret"],
|
||||
},
|
||||
)
|
||||
_log_rate_limits(response)
|
||||
_log_rate_limits(response, "POST", f"{self.base_url}/token/new/")
|
||||
response.raise_for_status()
|
||||
auth = response.json()
|
||||
self._save_auth(auth)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "leggen"
|
||||
version = "2025.9.24"
|
||||
version = "2025.10.0"
|
||||
description = "An Open Banking CLI"
|
||||
authors = [{ name = "Elisiário Couto", email = "elisiario@couto.io" }]
|
||||
requires-python = "~=3.13.0"
|
||||
|
||||
@@ -42,6 +42,9 @@ echo " > Version bumped to $NEXT_VERSION"
|
||||
echo "Updating CHANGELOG.md"
|
||||
git-cliff --unreleased --tag "$NEXT_VERSION" --prepend CHANGELOG.md > /dev/null
|
||||
|
||||
echo "Locking dependencies"
|
||||
uv lock
|
||||
|
||||
echo " > Commiting changes and adding git tag"
|
||||
git add pyproject.toml CHANGELOG.md uv.lock
|
||||
git commit -m "chore(ci): Bump version to $NEXT_VERSION"
|
||||
|
||||
Reference in New Issue
Block a user