introduce Wallet.normalize_endpoint to remove code duplication

This commit is contained in:
Pavol Rusnak
2024-01-22 10:06:22 -06:00
parent 824a8fa7c8
commit 8eabf53642
12 changed files with 25 additions and 27 deletions
+1 -2
View File
@@ -32,8 +32,7 @@ class LNbitsWallet(Wallet):
"cannot initialize LNbitsWallet: "
"missing lnbits_key or lnbits_admin_key or lnbits_invoice_key"
)
endpoint = settings.lnbits_endpoint
self.endpoint = endpoint[:-1] if endpoint.endswith("/") else endpoint
self.endpoint = self.normalize_endpoint(settings.lnbits_endpoint)
self.headers = {"X-Api-Key": key, "User-Agent": settings.user_agent}
self.client = httpx.AsyncClient(base_url=self.endpoint, headers=self.headers)