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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lnurl-0.1.1.tar.gz.
File metadata
- Download URL: lnurl-0.1.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7dfb65fcc65bfb55fc4daec690b4ea5565dad934b3668b71a604cbe13d79270
|
|
| MD5 |
7db94bd7d51b5fe42bc07ae7dc281f23
|
|
| BLAKE2b-256 |
d480fed3e3fdb5352bdf4b32c5ce30600c4dc486d129eb5b68e6902f83734180
|
File details
Details for the file lnurl-0.1.1-py3-none-any.whl.
File metadata
- Download URL: lnurl-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fef4d0197b30771643e4ee384577d8ccdffd4b51c92007bfe6b06fa19fb9cb0
|
|
| MD5 |
d6d275014e36d0f169de7b75164bfbf3
|
|
| BLAKE2b-256 |
5bc6e70c613ce4a6efee37b433046ab6857e7d337743b2dd2fc830d867a50f11
|