Skip to main content

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

Metadata

Release files for pyalby 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyalby 0.0.1
File Size Uploaded Provenance Actions
pyalby-0.0.1.tar.gz 9.7 kB Without provenance Details for pyalby-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyalby 0.0.1
File Interpreter ABI Platform Actions
pyalby-0.0.1-py3-none-any.whl Python 3 none any Details for pyalby-0.0.1-py3-none-any.whl

Total release size: 18.9 kB

Release files / pyalby-0.0.1.tar.gz

Download URL pyalby-0.0.1.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
52a01881871caae6bf8d388d4417233a97276f31281e45a6fa041ca74a2a02aa
BLAKE2b-256 checksum
How to use checksums
f7258f8a6b47782c09ceb5b3dbd886a36fa507273cd080d950c849cb96a35bff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.11

Release files / pyalby-0.0.1-py3-none-any.whl

Download URL pyalby-0.0.1-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e493930ce566a549be6ab3baec69941249c0488a2775757f6ee5d82efe779b98
BLAKE2b-256 checksum
How to use checksums
594c116c103f074eb3a2e48f21e28b497db918dcc5ce37b2ebe44043a8a56533
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.11

Security for pyalby 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page