set User-Agent when accessing external resources (#2100)

* set User-Agent when accessing external resources

* refactor User-Agent into settings.user_agent
This commit is contained in:
Pavol Rusnak
2023-11-30 12:54:07 +00:00
committed by GitHub
parent 992e3bfb9a
commit 62b0e3fe89
16 changed files with 70 additions and 43 deletions
+5 -2
View File
@@ -28,8 +28,11 @@ class LNPayWallet(Wallet):
self.wallet_key = wallet_key
self.endpoint = endpoint[:-1] if endpoint.endswith("/") else endpoint
self.auth = {"X-Api-Key": settings.lnpay_api_key}
self.client = httpx.AsyncClient(base_url=self.endpoint, headers=self.auth)
headers = {
"X-Api-Key": settings.lnpay_api_key,
"User-Agent": settings.user_agent,
}
self.client = httpx.AsyncClient(base_url=self.endpoint, headers=headers)
async def cleanup(self):
try: