🔌 BREB Consumer CLI
A Python client and CLI for the Bangladesh Rural Electrification Board (REB) / Palli Bidyut consumer API. Log in with your phone number, then look up customer details and your latest bill directly from your terminal.
✨ Features
- 🔐 Login: Passwordless login with a phone number — returns and stores a bearer token
- 👤 Customer Details: Name, address, PBS office, meter number, tariff, sanctioned load
- 🧾 Bill: Latest bill amount, late-payment amount, due dates, payment status, and arrears
- 🚀 Fast & Lightweight: Pure
requestsREST client, no browser needed
📦 Installation
From PyPI (Recommended)
pip install breb
From Source
git clone https://github.com/mdminhazulhaque/python-breb.git
cd python-breb
pip install -e .
🚀 Quick Start
After installation, use the breb-cli command:
# Get help
breb-cli --help
# Log in (token is saved to ~/.python-breb-api-config)
breb-cli login 01XXXXXXXXX
# Look up customer details
breb-cli customer-info 1010018581900
# Look up the latest bill
breb-cli bill 1010018581900
📖 Usage
Usage: breb-cli [OPTIONS] COMMAND [ARGS]...
A CLI tool for Bangladesh REB / Palli Bidyut consumer accounts.
Options:
--version Show the version and exit.
--help Show this message and exit.
Commands:
login Log in with a phone number and save the bearer token
customer-info Get customer and meter details for an SMS account number
bill Get the latest bill for an SMS account number
💡 Examples
🔐 Login
Login is passwordless — any registered phone number returns a token immediately. The token is saved locally and reused by subsequent commands.
$ breb-cli login 01XXXXXXXXX
🔐 Logging in with phone number 01XXXXXXXXX...
✅ Logged in. Token saved: 2098137|KyD...
👤 Customer Details
$ breb-cli customer-info 1010018581900
Sample Output:
📋 Customer Information:
Account Number 1010018581900
Name MD. MINHAZUL HAQUE
Father's Name ...
Address Jashore
PBS Jashore PBS-1
PBS Office ...
Tariff Category LT-A
Phase 1
Load (kW) 2
Meter Number 14705612
🧾 Bill
$ breb-cli bill 1010018581900
Sample Output:
🧾 Latest Bill:
Bill Number ...
Bill Month 2025-01
Used (kWh) 120
Billed Amount 845.00
Billed Amount + LPC 863.00
Bill Date 2025-01-05
Last Payment Date 2025-01-15
Payment Status Unpaid
Payment Channel ...
📌 Arrears:
Bill Month Receivable
------------ ------------
2024-12 845.00
🐍 Programmatic Use
from breb import BREBConsumerAPI
client = BREBConsumerAPI()
client.login(phone_number="01XXXXXXXXX") # token is stored and reused
customer = client.customer_info("1010018581900")
bill = client.bill("1010018581900")
print(customer["name"], customer["meter_number"])
print(bill["billed_amount"], bill["payment_status"])
🛠️ Development
Prerequisites
- Python 3.8 or higher
- pip package manager
Setting up for Development
git clone https://github.com/mdminhazulhaque/python-breb.git
cd python-breb
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e .
Dependencies
requests- HTTP library for API callsclick- Command line interface frameworktabulate- Pretty-print tabular data
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
⚠️ Disclaimer
This is an unofficial tool. Use at your own discretion. The authors are not responsible for any issues that may arise from using this tool.
Metadata
Release files for breb 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| breb-1.1.0.tar.gz | 6.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| breb-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.5 kB
Release files / breb-1.1.0.tar.gz
| Download URL | breb-1.1.0.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5433f177a4f07298212c2ebcd9fd7f81993db2a15242c7bb817e9683ce8dcc7d
|
|
BLAKE2b-256 checksum How to use checksums |
ede58420bd3c71a2801cb3f49b2c61b42eeb4c94c58fb179bd1b8c3f83da7bcd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / breb-1.1.0-py3-none-any.whl
| Download URL | breb-1.1.0-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4858d7d0222b44485df151d49f60c2cb5c8ab77a2b01f75cf9e17243088da064
|
|
BLAKE2b-256 checksum How to use checksums |
6fab467f9dae6a086702de799da1dacf2d9ce3ac6260eaed870b3bdc3cf9d001
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency log