tpos identifies itself via user-agent
This commit is contained in:
parent
3bbff31949
commit
33631d6375
1 changed files with 4 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ from http import HTTPStatus
|
||||||
import httpx
|
import httpx
|
||||||
from fastapi import Query
|
from fastapi import Query
|
||||||
from fastapi.params import Depends
|
from fastapi.params import Depends
|
||||||
|
from lnbits.settings import LNBITS_COMMIT
|
||||||
from lnurl import decode as decode_lnurl
|
from lnurl import decode as decode_lnurl
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
from starlette.exceptions import HTTPException
|
from starlette.exceptions import HTTPException
|
||||||
|
|
@ -134,7 +135,8 @@ async def api_tpos_pay_invoice(
|
||||||
|
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
try:
|
try:
|
||||||
r = await client.get(lnurl, follow_redirects=True)
|
headers = {"user-agent": f"lnbits/tpos commit {LNBITS_COMMIT[:7]}"}
|
||||||
|
r = await client.get(lnurl, follow_redirects=True, headers=headers)
|
||||||
if r.is_error:
|
if r.is_error:
|
||||||
lnurl_response = {"success": False, "detail": "Error loading"}
|
lnurl_response = {"success": False, "detail": "Error loading"}
|
||||||
else:
|
else:
|
||||||
|
|
@ -145,6 +147,7 @@ async def api_tpos_pay_invoice(
|
||||||
r2 = await client.get(
|
r2 = await client.get(
|
||||||
resp["callback"],
|
resp["callback"],
|
||||||
follow_redirects=True,
|
follow_redirects=True,
|
||||||
|
headers=headers,
|
||||||
params={
|
params={
|
||||||
"k1": resp["k1"],
|
"k1": resp["k1"],
|
||||||
"pr": payment_request,
|
"pr": payment_request,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue