Official Python SDK for BugBountyKE-KSP platform API
Project description
BugBountyKE-KSP Python SDK
Official Python SDK for the BugBountyKE-KSP Platform API.
pip install bugbounty-ksp-api-client
Features
- โจ Official SDK with full type hints & docstrings
- ๐ Secure API key generation & validation
- ๐ Authentication with API keys
- ๐ค Article publishing & management
- โก Comprehensive error handling
- ๐งช 100% test coverage (33 tests)
- ๐ Full documentation & examples
- ๐ Published on PyPI
Quick Start
1. Install the SDK
pip install bugbounty-ksp-api-client
2. Generate an API Key
from bugbounty_ksp.api import generate_api_key, APIKeyGenerator
# Generate a test API key
test_key = generate_api_key() # Returns sk_test_*****
print(test_key) # sk_test_aBcDeFgHiJkLmNoPqRsTuVwXyZ123456
# Or generate multiple keys
keys = APIKeyGenerator.generate_batch(count=5, test=True)
# Validate a key
is_valid = APIKeyGenerator.is_valid_format(test_key) # True
# Mask key for safe logging
masked = APIKeyGenerator.mask_key(test_key) # sk_test_****...6
3. Create Client & Publish
from bugbounty_ksp import BugBountyKSPAPIClient
import os
# Initialize client with API key
api_key = os.environ.get('BUGBOUNTY_API_KEY', 'sk_test_your_key')
client = BugBountyKSPAPIClient(api_key=api_key)
# Publish an article
response = client.publish_article(
title="Security Vulnerability Report",
content="# Vulnerability Details\n\nDetails here...",
frontmatter={
"title": "Security Vulnerability Report",
"tags": ["security", "bug-bounty"],
"category": "web"
},
file_path="/path/to/article.md"
)
print(f"Published! View at: {response.web_url}")
Installation
From PyPI (Recommended)
pip install bugbounty-ksp-api-client
From Source
git clone https://github.com/BugBounty-MockingBird/bugbounty-ksp-api-client.git
cd bugbounty-ksp-api-client
pip install -e .
Verify Installation
from bugbounty_ksp import BugBountyKSPAPIClient
from bugbounty_ksp.api import generate_api_key
print("SDK installed successfully!")
API Reference
Core Classes
BugBountyKSPAPIClient
Main client for interacting with the API.
client = BugBountyKSPAPIClient(
api_key="sk_test_...", # Required: API key
api_url="https://api.bugbounty-ksp.com", # Optional: Custom API URL
verify_ssl=True, # Optional: SSL verification
timeout=30 # Optional: Request timeout
)
Methods:
publish_article(title, content, frontmatter, file_path)- Publish articledelete_article(article_id)- Delete article_verify_authentication()- Check API key validity (called automatically)
APIKeyGenerator
Secure API key generation & validation.
from bugbounty_ksp.api.key_generator import APIKeyGenerator
# Generate single key
key = APIKeyGenerator.generate(test=True) # sk_test_*
prod_key = APIKeyGenerator.generate(test=False) # sk_*
# Generate batch
keys = APIKeyGenerator.generate_batch(count=5, test=True)
# Validate format
is_valid = APIKeyGenerator.is_valid_format(key)
# Mask for logging
masked = APIKeyGenerator.mask_key(key, visible_chars=4)
# Get info
info = APIKeyGenerator.get_key_info(key)
# Returns: {is_valid, length, masked, environment, type, prefix}
Convenience Functions:
from bugbounty_ksp.api import generate_api_key, generate_api_keys
# Generate test key
key = generate_api_key() # sk_test_*
# Generate multiple test keys
keys = generate_api_keys(count=5)
Exception Classes
from bugbounty_ksp.api.exceptions import (
APIError, # Base exception
AuthenticationError, # Invalid/missing API key
ValidationError, # Invalid input
RateLimitError, # Too many requests
NotFoundError, # Resource not found
NetworkError, # Network/connection issues
)
Getting Your API Key
- Log in to https://bugbountyke-ksp.com
- Go to Settings โ API Keys
- Click "Generate New Key"
- Copy the key immediately (shown only once)
- Store securely in environment variables
# .env or environment
export BUGBOUNTY_API_KEY="sk_test_your_key_here"
Error Handling
All API errors inherit from APIError and provide helpful messages.
from bugbounty_ksp import BugBountyKSPAPIClient
from bugbounty_ksp.api.exceptions import (
ValidationError,
AuthenticationError,
NetworkError,
RateLimitError,
)
client = BugBountyKSPAPIClient(api_key="sk_test_invalid")
try:
response = client.publish_article(
title="", # Invalid: empty title
content="Test"
)
except ValidationError as e:
print(f"Invalid input: {e}")
# Handle validation errors
except AuthenticationError as e:
print(f"Authentication failed: {e}")
# Check API key
except RateLimitError as e:
print(f"Rate limited: {e}")
# Wait before retrying
except NetworkError as e:
print(f"Network error: {e}")
# Handle connection issues
Development
Setup Development Environment
# Clone repository
git clone https://github.com/BugBounty-MockingBird/bugbounty-ksp-api-client.git
cd bugbounty-ksp-api-client
# Create virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e ".[dev]"
Running Tests
# Run all tests
pytest tests/ -v
# Run with coverage
pytest tests/ --cov=bugbounty_ksp --cov-report=html
# Run specific test class
pytest tests/test.py::TestAPIKeyGenerator -v
Code Quality
# Format code
black src/ tests/
# Lint
flake8 src/ tests/
# Type checking
mypy src/
Project Structure
bugbounty-ksp-api-client/
โโโ src/bugbounty_ksp/
โ โโโ __init__.py # Package exports
โ โโโ api/
โ โ โโโ __init__.py # API module exports
โ โ โโโ client.py # BugBountyKSPAPIClient class
โ โ โโโ exceptions.py # Custom exceptions
โ โ โโโ key_generator.py # APIKeyGenerator class
โ โ โโโ models.py # Response models
โ โโโ utils/
โ โโโ __init__.py
โ โโโ validators.py # Input validation
โโโ tests/
โ โโโ conftest.py # Pytest fixtures
โ โโโ test.py # 33 comprehensive tests
โโโ docs/ # Documentation
โโโ setup.py # Package setup
โโโ pyproject.toml # Project config
โโโ README.md # This file
Configuration
Environment Variables
# Required
export BUGBOUNTY_API_KEY="sk_test_your_key_here"
# Optional
export BUGBOUNTY_API_URL="https://api.bugbounty-ksp.com" # Default
export BUGBOUNTY_VERIFY_SSL="true" # Default
export BUGBOUNTY_TIMEOUT="30" # Default (seconds)
Custom Configuration
client = BugBountyKSPAPIClient(
api_key="sk_test_...",
api_url="https://staging-api.bugbounty-ksp.com", # Custom environment
verify_ssl=False, # Disable SSL for testing
timeout=60 # Longer timeout for large uploads
)
Contributing
We welcome contributions! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Write tests for your changes
- Ensure all tests pass (
pytest tests/) - Follow code style (
black,flake8,mypy) - Commit your changes (
git commit -m 'Add amazing feature') - Push to your branch (
git push origin feature/amazing-feature) - Open a Pull Request
Code Quality Requirements:
- โ All tests passing
- โ Type hints on all functions
- โ Docstrings on public methods
- โ Code formatted with Black
- โ No linting errors with Flake8
- โ Type checking passes with MyPy
License
MIT License - see LICENSE
Support & Links
- ๐ฆ PyPI: https://pypi.tw.martin98.com/project/bugbounty-ksp-api-client/
- ๐ Issues: https://github.com/BugBounty-MockingBird/bugbounty-ksp-api-client/issues
- ๐ Docs: https://docs.bugbounty-ksp.com/
- ๐ Website: https://bugbountyke-ksp.com
- ๐ง Email: team@bugbounty-ksp.com
Changelog
v1.0.0 (February 5, 2026) - Initial Release
- โจ Official Python SDK release
- ๐ API key generation & validation
- ๐ค Article publishing & management
- โก Comprehensive error handling
- ๐งช 33 passing tests (100% coverage)
- ๐ฆ Published to PyPI
Made with โค๏ธ by the BugBountyKE-KSP Team
Part of the BugBountyKE-KSP initiative to centralize cybersecurity knowledge and bridge hunters' expertise.
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 bugbounty_ksp_api_client-1.0.1.tar.gz.
File metadata
- Download URL: bugbounty_ksp_api_client-1.0.1.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e0b58b001fde5a18d54e359694620c352c36726cf4c29876578ff03e746ca34
|
|
| MD5 |
e5ba0d9cb1b615dffd6b4be8ced1f1e2
|
|
| BLAKE2b-256 |
a9a88f29acddbb6eff9a2b561ad97982286ee18f4155104ee2af0fb33e1017ff
|
File details
Details for the file bugbounty_ksp_api_client-1.0.1-py3-none-any.whl.
File metadata
- Download URL: bugbounty_ksp_api_client-1.0.1-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
277f76529d05deba97b066e3c032e07f11ffea5ec77e7833216198e3b113041e
|
|
| MD5 |
2823a961f754c4064d524d408b5d5f7a
|
|
| BLAKE2b-256 |
8ac7b3e3c072296bed6174eb5c2cbbbd6dace8d47984f709ef54f257ff1b4bbf
|