Skip to content

Conversation

@Chocapikk
Copy link
Member

@Chocapikk Chocapikk commented Feb 3, 2026

Summary

This PR enhances the LeakIX Python client with modern async support and improved developer experience.

New Features

  • AsyncClient: Full async/await support using httpx for async applications (MCP servers, FastAPI, etc.)
  • Simple search() API: Intuitive method accepting raw query strings like the website
  • Account status: get_api_status() and is_pro() methods using /api/user/info endpoint (cached)
  • Rate limit handling: Automatic retry with exponential backoff on 429 responses
  • Streaming bulk export: Memory-efficient bulk_export_stream() generator

API Examples

# Sync client
from leakix import Client
client = Client(api_key="...")
results = client.search("+plugin:GitConfigHttpPlugin", scope="leak")

# Check account status (cached)
status = client.get_api_status()
print(status["quota"]["remaining"])  # API credits left
print(status["is_pro"])              # Pro subscription
print(status["level"])               # User level (User, BountyHunter, etc.)

# Async client
from leakix import AsyncClient
async with AsyncClient(api_key="...") as client:
    results = await client.search("+country:FR +port:22", scope="service")
    status = await client.get_api_status()  # Cached

get_api_status() Response

Uses the new /api/user/info endpoint (requires frontend update):

{
  "authenticated": true,
  "username": "myuser",
  "email": "user@example.com",
  "level": "BountyHunter",
  "is_pro": true,
  "quota": {"total": 30000, "remaining": 29500, "used": 500},
  "features": ["search", "host_lookup", "bulk_export", "pro_plugins"],
  "created": 1234567890
}

Why AsyncClient?

  • Required for MCP servers (Model Context Protocol)
  • Works with FastAPI, aiohttp, and other async frameworks
  • Rate limit retry with exponential backoff (1s, 2s, 4s on 429)
  • Streaming support for large bulk exports

Changes

  • Lower Python requirement from 3.13 to 3.10
  • Add leakix/async_client.py with full async implementation
  • Add search(), get_domain(), get_api_status(), is_pro() to both clients
  • Add bulk_export_stream() for memory-efficient streaming
  • Export AsyncClient from package root

@Chocapikk Chocapikk force-pushed the feat/add-endpoints-and-update-deps branch 2 times, most recently from 5c2a262 to 36040bb Compare February 3, 2026 09:56
@Chocapikk Chocapikk changed the title Feat: Add endpoints and update dependencies WIP: Feat: Add endpoints and update dependencies Feb 3, 2026
@Chocapikk Chocapikk force-pushed the feat/add-endpoints-and-update-deps branch from cd8ad7e to dacd9ca Compare February 3, 2026 10:10
@Chocapikk Chocapikk changed the title WIP: Feat: Add endpoints and update dependencies Feat: Add search() API, new endpoints, and documentation Feb 3, 2026
- Add search(query, scope, page) for simple query string syntax
- Add get_domain() endpoint for domain lookups
- Bump version to 0.2.0
@Chocapikk Chocapikk force-pushed the feat/add-endpoints-and-update-deps branch from dacd9ca to 573a622 Compare February 3, 2026 10:14
@Chocapikk Chocapikk changed the title Feat: Add search() API, new endpoints, and documentation Feat: Add search() and get_domain() methods Feb 3, 2026
- Add bulk_export_stream() generator for memory-efficient streaming
- Add bulk_service_stream() generator for memory-efficient streaming
@Chocapikk Chocapikk changed the title Feat: Add search() and get_domain() methods Feat: Add search(), get_domain() and streaming bulk methods Feb 3, 2026
@Chocapikk Chocapikk changed the title Feat: Add search(), get_domain() and streaming bulk methods Feat: Add search(), get_domain() and streaming bulk Feb 3, 2026
- Add AsyncClient class using httpx for async operations
- Support context manager (async with)
- Add bulk_export_stream async generator
- Add httpx dependency
- Update README with async examples
AsyncClient now automatically retries on 429 responses with exponential
backoff (1s, 2s, 4s). Max 3 retries before returning None.
- Add get_api_status(force=False) to both Client and AsyncClient
- Add is_pro() convenience method to both clients
- Cache API status per client instance (query Pro only once)
- Detect Pro subscription by testing WpUserEnumHttp plugin
@Chocapikk Chocapikk changed the title Feat: Add search(), get_domain() and streaming bulk Feat: Add AsyncClient, search API, and Pro detection Feb 3, 2026
- Replace Pro detection hack (querying Pro-only plugins) with proper
  /api/user/info endpoint call
- Returns accurate data: username, email, level, is_pro, quota, features
- Still cached per client instance for efficiency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant