G8KEPR API Security Platform - Python SDK
Project description
G8KEPR Python SDK
Official Python SDK for the G8KEPR API Security Platform.
Installation
pip install g8kepr
Quick Start
from g8kepr import G8KEPRClient
# Initialize client
client = G8KEPRClient(
base_url="https://api.g8kepr.com",
api_key="your-api-key"
)
# Or authenticate with email/password
client.auth.login(email="user@example.com", password="...")
# List AI agents
agents = client.agents.list()
for agent in agents:
print(f"Agent: {agent['name']} - Status: {agent['status']}")
# Get recent threats
threats = client.threats.get_recent(limit=10)
for threat in threats:
print(f"Threat: {threat['type']} - Severity: {threat['severity']}")
# MCP server management
servers = client.mcp.list_servers()
Features
Authentication
# Login
result = client.auth.login("user@example.com", "password")
# Get current user
user = client.auth.me()
# Refresh token
client.auth.refresh_token()
AI Agents
# List agents
agents = client.agents.list(status="active")
# Create agent
agent = client.agents.create(
name="MyAgent",
description="Production agent",
capabilities=["tool_use", "memory"],
tools=["read_file", "write_file"]
)
# Update agent
client.agents.update(agent["id"], status="inactive")
# Get interactions
interactions = client.agents.get_interactions(agent["id"])
MCP Security
# List MCP servers
servers = client.mcp.list_servers()
# Register server
server = client.mcp.register_server(
name="filesystem-server",
server_type="stdio",
connection_string="npx @modelcontextprotocol/server-filesystem"
)
# Check permissions
result = client.mcp.check_permission(
server_id="...",
tool_name="read_file",
arguments={"path": "/etc/passwd"}
)
print(f"Allowed: {result['allowed']}, Reason: {result['reason']}")
# Create permission rule
client.mcp.create_permission(
permission_type="user",
action="deny",
tool_name="delete_*",
priority=100
)
Threat Detection
# Get recent threats
threats = client.threats.get_recent(
limit=100,
threat_type="sql_injection",
blocked_only=True
)
# Get statistics
stats = client.threats.get_stats(period_hours=24)
print(f"Total threats: {stats['total']}")
print(f"Blocked: {stats['blocked']}")
# Block IP
client.threats.block_ip(
ip_address="192.168.1.100",
reason="Repeated SQL injection attempts",
duration_hours=24
)
Dashboard
# Get overview
overview = client.dashboard.get_overview()
# Get metrics
metrics = client.dashboard.get_metrics(period="7d", granularity="day")
# Get security score
score = client.dashboard.get_security_score()
print(f"Security Score: {score['overall']}/100")
Error Handling
from g8kepr import G8KEPRClient
from g8kepr.exceptions import (
AuthenticationError,
RateLimitError,
NotFoundError,
ValidationError,
)
client = G8KEPRClient(base_url="https://api.g8kepr.com")
try:
client.auth.login("user@example.com", "wrong_password")
except AuthenticationError as e:
print(f"Login failed: {e.message}")
try:
client.agents.get("nonexistent-id")
except NotFoundError as e:
print(f"Agent not found: {e.message}")
try:
# Rapid requests
for i in range(1000):
client.threats.get_recent()
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after} seconds")
Context Manager
# Automatic cleanup
with G8KEPRClient(base_url="...", api_key="...") as client:
agents = client.agents.list()
Requirements
- Python 3.8+
- httpx >= 0.24.0
License
Copyright (c) 2024-2025 Wesley Ellis. All Rights Reserved.
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
g8kepr-1.0.0.tar.gz
(10.7 kB
view details)
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
g8kepr-1.0.0-py3-none-any.whl
(12.2 kB
view details)
File details
Details for the file g8kepr-1.0.0.tar.gz.
File metadata
- Download URL: g8kepr-1.0.0.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77c2907c376e498f65f6769213240f8cd7bb57fa739cafcdd95e704d65b46ba3
|
|
| MD5 |
5beba9122af2d1fdc1d8ae01413fc4b2
|
|
| BLAKE2b-256 |
527f4b2a6580fd9442cf905147cdbed4cc2f8e9230ce888e027fcc5fc0da4447
|
File details
Details for the file g8kepr-1.0.0-py3-none-any.whl.
File metadata
- Download URL: g8kepr-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36c339a79ab894dd6b66cf64f7cf01d275eb209968b50bfcd122c7985c0d4a7d
|
|
| MD5 |
fe9e5408c4e5d54b69200962f0e495bd
|
|
| BLAKE2b-256 |
68b545650ec2f115b9de1725e935ff3864941fde69b19f7fe6bf1233057671a9
|