Skip to main content

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

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

whitelisthub-1.1.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

whitelisthub-1.1.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

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

Hashes for whitelisthub-1.1.0.tar.gz
Algorithm Hash digest
SHA256 cd00156fa471942754f53bcc2f07f95c19213dabb23961afc1aa7c96635d6893
MD5 05cb21085f646e4bac241359bcd617db
BLAKE2b-256 5c930a6fc6b7133bb36d8b7aef99cfbc76352885ee5beea8fc969e0e56158a85

See more details on using hashes here.

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

Hashes for whitelisthub-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 68688e050790f7c02139045de28bdb3081a84745f5e808e92f4282a378b480e4
MD5 4a91191852f509f8413b8ab567732821
BLAKE2b-256 54e86fb32ec79b36ff016cc01835a69de1af36c3ea3369cf5921604a1f970389

See more details on using hashes here.

Supported by

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