Python library to generate PromptPay QR Code
Project description
PromptPay
Python library to generate PromptPay QR Code, inspired from dtinth/promptpay-qr
Installation
pip install promptpay
# or
git clone https://github.com/jojoee/promptpay
cd promptpay
python setup.py install
Usage
Library
from promptpay import qrcode
# generate a payload
id_or_phone_number = "0841234567"
payload = qrcode.generate_payload(id_or_phone_number)
payload_with_amount = qrcode.generate_payload(id_or_phone_number, 1.23)
# export to PIL image
img = qrcode.to_image(payload)
# export to file
qrcode.to_file(payload, "./qrcode-0841234567.png")
qrcode.to_file(payload_with_amount, "/Users/joe/Downloads/qrcode-0841234567.png")
CLI
python -m promptpay qrcode --id="0841234567"
python -m promptpay qrcode --id="0841234567" --file="./qrcode-cli.png"
python -m promptpay qrcode --id="0841234567" --show=true
python -m promptpay qrcode \
--id="0841234567" \
--amount=2.34 \
--file="/Users/joe/Downloads/qrcode-cli-with-amount.png"
Development
# Conda env
conda create --name promptpay3.10 python=3.10.4
conda activate promptpay3.10
conda create --name promptpay3.7 python=3.7.13
conda activate promptpay3.7
conda remove --name promptpay3.10 --all
# others
pip install -r requirements.txt
pip install -r requirements-dev.txt
python -m flake8 --ignore=E501 promptpay tests
python -m pytest tests --cov=./ --cov-report=xml
pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
python -m pip list --format=freeze > requirements-tmp.txt
pip install libscrc==
pip install Pillow==
Reference
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
promptpay-1.1.7.tar.gz
(5.1 kB
view details)
Built Distribution
File details
Details for the file promptpay-1.1.7.tar.gz
.
File metadata
- Download URL: promptpay-1.1.7.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9885e756d404a81b8eebfae1a586e37ea9e87ab8d5c1d40fd7384637c48c4030 |
|
MD5 | 6d098dcc33b24d02d72b0f81bd0fb62e |
|
BLAKE2b-256 | fa0a029801783ff9247b4acb87cae2ecfa3a08aa6db4e087e7cc3a4577a2a989 |
File details
Details for the file promptpay-1.1.7-py3-none-any.whl
.
File metadata
- Download URL: promptpay-1.1.7-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16a6f89ec8c9aad96d189910025e53353fa138412212ad553c82cedfbc355885 |
|
MD5 | 535f3fcc9deedb3ad5ce7f27c7f143be |
|
BLAKE2b-256 | cc99a2b4cc205f9a5e1b16a3b89b94eeb63631df90ec4bb3c379899731a571c9 |