Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add follow_redirect, timeout, useragent #33

Merged
merged 5 commits into from
May 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup!
  • Loading branch information
dni committed May 8, 2024
commit ea1d8d06b7d1d88c5498d978fe21f1e973dfe8d0
7 changes: 4 additions & 3 deletions lnurl/core.py
Original file line number Diff line number Diff line change
@@ -118,14 +118,15 @@ async def execute_pay_request(
timeout=timeout or TIMEOUT,
)
res2.raise_for_status()
assert isinstance(res2, LnurlPayActionResponse), "Invalid response in execute_pay_request."
invoice = bolt11_decode(res2.pr)
pay_res = LnurlResponse.from_dict(res2.json())
assert isinstance(pay_res, LnurlPayActionResponse), "Invalid response in execute_pay_request."
invoice = bolt11_decode(pay_res.pr)
if invoice.amount_msat != int(msat):
raise LnurlResponseException(
f"{res.callback.host} returned an invalid invoice."
f"Excepted `{msat}` msat, got `{invoice.amount_msat}`."
)
return LnurlResponse.from_dict(res2.json())
return pay_res
except Exception as exc:
raise LnurlResponseException(str(exc))

1 change: 1 addition & 0 deletions lnurl/models.py
Original file line number Diff line number Diff line change
@@ -138,6 +138,7 @@ class LnurlPayActionResponse(LnurlResponseModel):
pr: LightningInvoice
success_action: Optional[Union[MessageAction, UrlAction, AesAction]] = Field(None, alias="successAction")
routes: List[List[LnurlPayRouteHop]] = []
verify: Optional[str] = None


class LnurlWithdrawResponse(LnurlResponseModel):
Loading