Skip to main content

Python library for Alby Wallet API

Project description

pyalby

A python library of methods for accessing Alby Wallet API.

Contributors Forks Issues MIT License

Table of Contents
  1. About The Project
  2. Getting Started
  3. Roadmap
  4. Contributing
  5. License
  6. Contact

About The Project

The python library pyalby contains methods for accessing Alby Wallet API. The main purpose of this library is to provide a simple way to interact with the Alby API when using python.

Note: Custodial Wallets are not recommended for the use of storing large amounts. This library is for experimental purposes in the area of micro-payments. Use it at your own risk. This library is not a replacement for the official Alby API documentation. It is recommended to read the official documentation before using this library.

Getting Started

Clone the repo

Requires Python 3.10 or 3.11

git clone https://github.com/f418me/pyalby.git
cd pyalby
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -e .

Library Installation

pip install pyalby

Alby Access Token

You need an alby account and generate an access token to use the API. Copy .env-example to .env and update the variables with your Alby token. Or just set the environment variable ALBY_ACCESS_TOKEN.

BASE_URL = https://api.getalby.com
ALBY_ACCESS_TOKEN = XYZ
LOG_LEVEL = INFO

Usage

After the import of pyalby you can access the complete API using the related methods. In the tests folder you find all examples of the usage of the library.

from pyalby import Account, Invoice, Payment
import logging
import os

# Load environment variables
load_dotenv()

def main():
   
   account = Account()
   invoice = Invoice()
   payment = Payment()

   logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s', level=str(os.getenv("LOG_LEVEL")))

   # Fetch account summary
   summary_data = account.get_account_summary()
   print("Account Summary:", summary_data)

   # Create an invoice
   inv = invoice.create_invoice(amount=100, description="Alby Test Invoice")
   print("Invoice created successfully")
   print(inv)

   # Pay an invoice
   pay = payment.bolt11_payment("lnbc110n1pn...")
   print(pay)


if __name__ == "__main__":
   main()

Roadmap

  • Add Webhook API
  • Add GitHub Docs pages
  • Add Support of async requests
  • CI pipeline
  • Add OAuth2 support
  • Add Python 3.12 support

See the open issues for a full list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Other

Be aware that the integration tests send real keysend payments.

License

The projec pyalby is released under the terms of the MIT license. See https://opensource.org/licenses/MIT for further information.

Contact

[f418.me](https://f418_me - Twitter - info@f418.me

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyalby-0.0.1.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

pyalby-0.0.1-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file pyalby-0.0.1.tar.gz.

File metadata

  • Download URL: pyalby-0.0.1.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.11

File hashes

Hashes for pyalby-0.0.1.tar.gz
Algorithm Hash digest
SHA256 52a01881871caae6bf8d388d4417233a97276f31281e45a6fa041ca74a2a02aa
MD5 a95ec1b4a3b08928e182d957b059f97d
BLAKE2b-256 f7258f8a6b47782c09ceb5b3dbd886a36fa507273cd080d950c849cb96a35bff

See more details on using hashes here.

File details

Details for the file pyalby-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyalby-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.11

File hashes

Hashes for pyalby-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e493930ce566a549be6ab3baec69941249c0488a2775757f6ee5d82efe779b98
MD5 5cecb298f2ccc4d0f719605fb0e99261
BLAKE2b-256 594c116c103f074eb3a2e48f21e28b497db918dcc5ce37b2ebe44043a8a56533

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page