Skip to main content

23 production-ready Python code templates: TG bots, scrapers, AI agents, crypto trading, Tor, JWT auth, proxy rotation, rate limiter, webhook server, async task queue.

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.

Python Dependencies License

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 registrylist_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

darkbot_templates-1.6.2.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

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

darkbot_templates-1.6.2-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file darkbot_templates-1.6.2.tar.gz.

File metadata

  • Download URL: darkbot_templates-1.6.2.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for darkbot_templates-1.6.2.tar.gz
Algorithm Hash digest
SHA256 2e55af505a936dea8a4c70b4f51088af1e8ff59274d1d6adaa24799686d85a3f
MD5 1b6987d812c31a2fe11c83b0f2b0cbf8
BLAKE2b-256 0af56ecee899fe873a6a6336de47fb2e1d3087d0982b4ded5b11e4c3041d7542

See more details on using hashes here.

File details

Details for the file darkbot_templates-1.6.2-py3-none-any.whl.

File metadata

File hashes

Hashes for darkbot_templates-1.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6b9d9f99adad5cc8aa1b5d9df6586a3733a75d74e932f61c44c9012af3eb553b
MD5 1f42218e0e72add0e98b448c1196d8a3
BLAKE2b-256 fce14dc028967b82a1e9b6f6de4f851ed76678271d6146150ffdfcc864477699

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