LNURL implementation for Python.
Project description
LNURL implementation for Python
Basic usage
import lnurl
lnurl.encode('https://example.com/c?p=a8dw93x2h39s1f')
lnurl.decode('LNURL1DP68GURN8GHJ7ETCV9KHQMR99E3K7MF0VVLHQ0TP8PJ8WWFN0QEXSVEEWVCKVF3A4RP')
Advanced usage
The Lnurl
object wraps a bech32 LNURL to provide some extra utilities.
from lnurl import Lnurl
lnurl = Lnurl('LNURL1DP68GURN8GHJ7ETCV9KHQMR99E3K7MF0VVLHQ0TP8PJ8WWFN0QEXSVEEWVCKVF3A4RP')
lnurl.bech32 # 'LNURL1DP68GURN8GHJ7ETCV9KHQMR99E3K7MF0VVLHQ0TP8PJ8WWFN0QEXSVEEWVCKVF3A4RP'
lnurl.decoded # 'https://example.com/c?p=a8dw93x2h39s1f'
lnurl.url.base # 'https://example.com/c'
lnurl.url.query_params # {'p': 'a8dw93x2h39s1f'}
You can also use a LnurlResponse
to wrap responses you get from a LNURL.
The different types of responses defined in the LNURL specification have a different response class
with different properties (see models.py
):
import requests
from lnurl import Lnurl, LnurlWithdrawResponse
lnurl = Lnurl('LNURL1DP68GURN8GHJ7UM9WFMXJCM99E3K7MF0V9CXJ0M384EKZAR0WD5XJ0JELRS')
res = requests.get(lnurl.decoded)
withdraw = LnurlWithdrawResponse(res.json())
withdraw.max_sats # int
withdraw.callback.base # str
withdraw.callback.query_params # dict
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lnurl-0.1.1.tar.gz
(4.0 kB
view hashes)
Built Distribution
lnurl-0.1.1-py3-none-any.whl
(5.5 kB
view hashes)