40 production-ready Python templates: JWT, rate limiter, webhook, task queue, config, Docker health, crypto wallet, email, cron, HTTP client, SQLite ORM, log, CSV, metrics, cache, pub/sub, state machine, file watcher, retry queue, signal handler, plugin loader.
Project description
DarkBot AI Templates
20 production-ready Python code templates: TG bots, scrapers, AI agents, crypto trading, Tor, JWT auth, proxy rotation. Zero dependencies.
What's New in 1.6.0
- JWT Auth template — HMAC-SHA256/384/512 token generation, verification, refresh tokens. Pure stdlib (hmac, hashlib, json, base64).
- Proxy Rotation Manager — round-robin, random, least-failed, fastest strategies with health checking and EMA latency tracking.
- Template registry —
list_templates(),get_template(name),manifest()for programmatic discovery. - Importable templates — templates ship as Python modules, not just text files.
Available Templates
| # | Template | Description |
|---|---|---|
| 1 | jwt_auth | JWT token generation/verification with HMAC-SHA256/384/512 |
| 2 | proxy_rotation | Proxy pool with health checks, 4 rotation strategies, failover |
| 3-20 | (existing) | TG bots, scrapers, AI agents, crypto trading, Tor, and more |
Quick Start
pip install darkbot-templates
JWT Authentication
from darkbot_templates.templates.jwt_auth import JWTAuth
auth = JWTAuth(secret="your-secret-key")
# Generate token
token = auth.encode({"user_id": 42, "role": "admin"})
# eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
# Verify and decode
payload = auth.decode(token)
print(payload["user_id"]) # 42
print(payload["role"]) # admin
# Refresh expired token
new_token = auth.refresh(token)
# Create 7-day refresh token
refresh = auth.create_refresh_token("user_42")
Proxy Rotation
from darkbot_templates.templates.proxy_rotation import ProxyRotationManager
manager = ProxyRotationManager(
proxies=["http://proxy1:8080", "http://proxy2:8080", "http://proxy3:3128"],
strategy="round_robin", # or: random, least_failed, fastest
max_failures=3,
timeout=10,
)
# Get next proxy
proxy = manager.get_proxy()
# Fetch with automatic failover
content = manager.fetch("https://httpbin.org/ip")
# Check pool health
stats = manager.stats()
print(f"{stats['healthy']}/{stats['total_proxies']} healthy")
Template Registry
from darkbot_templates.registry import list_templates, get_template, manifest
# List all templates
for t in list_templates():
print(f" {t['name']}: {t['description']}")
# Get template source code
source = get_template("jwt_auth")
# Full manifest
m = manifest()
print(f"Version {m['version']}, {m['template_count']} templates")
License
MIT
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 darkbot_templates-1.7.3.tar.gz.
File metadata
- Download URL: darkbot_templates-1.7.3.tar.gz
- Upload date:
- Size: 73.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c39ff596be869f8c17574cd9cf9c30622c01d672512ace8d2ea776bc52a98bb
|
|
| MD5 |
7ec4189c5ab733cb5f8957b972fe55c2
|
|
| BLAKE2b-256 |
b3401fd078d4e2805ba109a1f4b4b0229a600077279220271bef275a430f70c4
|
File details
Details for the file darkbot_templates-1.7.3-py3-none-any.whl.
File metadata
- Download URL: darkbot_templates-1.7.3-py3-none-any.whl
- Upload date:
- Size: 63.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85cb7e05f2eada67b8970ab4a1a55f739b5416421ceae73df577eff44acb8270
|
|
| MD5 |
91a88ce9b8cf3a5eccad6fd08bd389e7
|
|
| BLAKE2b-256 |
fe7b73d9b2f1d1b4de0b27f451611eac6e282ee2b43a77bc13a9cdd024824df9
|