A Python library for interacting with Speed API and managing Lightning Network invoices
Project description
speedapi_lib
This is a Python library for interacting with the Speed API and managing Lightning Network invoices.
Installation
You can install this library from your private GitHub repository:
pip install speedapi-lib
Usage
from speedapi_lib.speedapi import SpeedAPI
# Initialize the SpeedAPI class with user-provided inputs
api = SpeedAPI(secret_key='your_secret_key', base_url='https://api.tryspeed.com')
# Get balance in SATS
balance = api.get_balance_sats()
print(f"Balance: {balance} SATS")
# Decode and print invoice details
invoice_str = "your_invoice_here"
invoice_info = api.get_invoice_info(invoice_str)
print(invoice_info)
# Pay the invoice if balance is sufficient
if balance >= invoice_info["amount"]:
payment_response = api.pay_invoice(invoice_str)
print("Payment successful:", payment_response)
else:
print("Insufficient balance to pay invoice")
License
This project is licensed under the MIT License - see the LICENSE file for details.
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
speedapi_lib-0.1.3.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for speedapi_lib-0.1.3-py3-none-any.whl
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 09f0abea5aa88d8af1aa9f9a7ea03471874f335dea9962e778067877e3fecf8f |
|
| MD5 | 895cf89bd7922fb169c08e068b56ab04 |
|
| BLAKE2b-256 | 882dd7c95bb3078e1bcf0db59918dc1b0d2ba5d9728fd77aa0c3b3ba4b6010ee |