Official Python SDK for the WhitelistHub partner API
Project description
WhitelistHub
Official Python client for the WhitelistHub partner API.
- Pure Python, no third-party dependencies
- Keys, balance, pricing, dynamic VLESS API
- HMAC verification for outbound panel webhooks
Install
pip install whitelisthub
Quickstart
from whitelisthub import PanelClient
client = PanelClient("https://whitelisthub.net", api_token="YOUR_TOKEN")
# [whitelisthub] whitelisthub.net — connected (42 ms) | balance 1500.00 RUB
key = client.keys.create(
limit_gb=50,
months=1,
user_id="tg:1",
idempotency_key="order-1",
)
print(key.subscription_url)
Disable the startup health check:
client = PanelClient(
"https://whitelisthub.net",
api_token="YOUR_TOKEN",
auto_connect=False,
)
From environment (WHITELISTHUB_API_TOKEN, optional WHITELISTHUB_URL):
client = PanelClient.from_env()
Keys
client.keys.info(key.key_id)
client.keys.renew(key.key_id, months=1)
client.keys.expand(key.key_id, limit_gb=100)
client.keys.reset(key.key_id)
client.keys.ban(key.key_id, message="blocked")
client.keys.unban(key.key_id)
client.keys.delete(key.key_id)
Webhooks
The panel signs outbound events with X-Signature: sha256=<hmac> over the
raw request body. Verify with the raw bytes (e.g. Flask request.get_data()),
not a re-encoded JSON document.
from flask import Flask, request
from whitelisthub import verify_partner_webhook
app = Flask(__name__)
@app.post("/hooks/panel")
def panel_hook():
data = verify_partner_webhook(
request.get_data(),
signature=request.headers.get("X-Signature"),
secret="YOUR_WEBHOOK_SECRET",
max_age_sec=600,
)
return {"ok": True, "event": data["event"]}
Docs
- API reference: https://whitelisthub.net/partner/docs
- Packaging: https://packaging.python.org/en/latest/
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file whitelisthub-1.1.0.tar.gz.
File metadata
- Download URL: whitelisthub-1.1.0.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd00156fa471942754f53bcc2f07f95c19213dabb23961afc1aa7c96635d6893
|
|
| MD5 |
05cb21085f646e4bac241359bcd617db
|
|
| BLAKE2b-256 |
5c930a6fc6b7133bb36d8b7aef99cfbc76352885ee5beea8fc969e0e56158a85
|
File details
Details for the file whitelisthub-1.1.0-py3-none-any.whl.
File metadata
- Download URL: whitelisthub-1.1.0-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68688e050790f7c02139045de28bdb3081a84745f5e808e92f4282a378b480e4
|
|
| MD5 |
4a91191852f509f8413b8ab567732821
|
|
| BLAKE2b-256 |
54e86fb32ec79b36ff016cc01835a69de1af36c3ea3369cf5921604a1f970389
|