Python SDK for the Sika Security platform
Project description
sika-python
Python SDK and CLI for the Sika Security platform.
Two packages, one repo:
| Package | PyPI | Purpose |
|---|---|---|
sika-sdk |
pip install sika-sdk |
Typed Python client for all Sika product APIs |
sika-cli |
pip install sika-sdk[cli] |
Unified sika command-line interface |
Installation
# SDK only (for programmatic use)
pip install sika-sdk
# SDK + CLI (for the `sika` command)
pip install sika-sdk[cli]
Requires Python 3.11+.
Quick Start
from sika import SikaClient
# Authenticate with an API key
client = SikaClient(api_key="st_recon_...")
# Submit a recon scan
scan = client.recon.scans.create("example.com")
print(f"Scan {scan.scan_id}: {scan.status}")
# Retrieve scan details
scan = client.recon.scans.get(scan.scan_id)
print(f"Status: {scan.status}")
# List all scans
for scan in client.recon.scans.list():
print(f"{scan.domain} — {scan.status}")
# Wait for scan completion (polls automatically)
scan = client.recon.scans.wait(scan.scan_id, timeout=300, poll_interval=5)
print(f"Completed: {scan.summary}")
# Download a report
report = client.recon.scans.report(scan.scan_id, format="json")
print(f"Download: {report.url}")
# Check service health
health = client.recon.health()
print(f"Service: {health.status}, version: {health.version}")
# Intel database status
intel = client.recon.intel.status()
print(f"Intel updated: {intel.last_updated}")
# Delete a scan
client.recon.scans.delete(scan.scan_id)
CLI
# Set your API key
export SIKA_API_KEY="st_recon_..."
# Submit a recon scan
sika recon scan example.com
# Submit and wait for completion
sika recon scan example.com --attach
# List recent scans
sika recon jobs list
# Filter by status
sika recon jobs list --status completed
# View scan details
sika recon jobs get <scan_id>
# Download a report (JSON, HTML, or CSV)
sika recon pull <scan_id>
sika recon pull <scan_id> --format html --output report.html
# Batch scan: submit multiple domains from a file
sika recon scan --file targets.txt
# Batch scan with explicit tag
sika recon scan --file targets.txt --tag engagement-acme
# Tag a single scan
sika recon scan example.com --tag pentest-q1
# JSON output for scripting
sika --json recon jobs list
sika --quiet recon scan example.com # prints only scan_id
# Authenticate via browser (creates API token, stores in ~/.sika/credentials)
sika auth login
# Check authentication status
sika auth status
# Log out (remove stored credentials)
sika auth logout
Global options: --json, --quiet, --no-color, --profile, --env.
Exit codes: 0 success, 1 error, 2 auth, 3 forbidden/quota, 4 not found, 5 validation, 130 interrupted.
Authentication
The SDK resolves credentials in this order (highest priority first):
- Constructor parameter:
SikaClient(api_key="...") - Product-specific env var:
SIKA_RECON_API_KEY - Global env var:
SIKA_API_KEY - Credential file:
~/.sika/credentials(TOML format)
# Explicit key
client = SikaClient(api_key="st_recon_...")
# Or set SIKA_API_KEY in your environment and omit api_key
client = SikaClient()
Credential file
The credential file uses TOML format and supports named profiles:
[default]
api_key = "st_recon_..."
[profiles.staging]
api_key = "st_recon_..."
Use a named profile:
client = SikaClient(profile="staging")
The credential file must have 0600 permissions (owner read/write only).
The SDK warns if the file is group- or world-readable.
Error Handling
The SDK maps API error responses (RFC 7807
Problem Details) to a typed exception hierarchy. All exceptions inherit
from SikaError and carry the HTTP status code, machine-readable error
code, and human-readable detail message.
from sika import (
SikaClient,
SikaError,
AuthenticationError,
NotFoundError,
QuotaExceededError,
ValidationError,
)
client = SikaClient(api_key="st_recon_...")
try:
scan = client.recon.scans.get("nonexistent-id")
except NotFoundError as e:
print(f"Not found: {e.detail}")
except AuthenticationError:
print("Check your API key")
except QuotaExceededError as e:
print(f"Quota exceeded: {e.current}/{e.limit} {e.dimension}")
if e.upgrade_url:
print(f"Upgrade at: {e.upgrade_url}")
except ValidationError as e:
print(f"Invalid request: {e.detail}")
for field_error in e.errors:
print(f" - {field_error}")
except SikaError as e:
print(f"API error [{e.status_code}]: {e.detail}")
Exception hierarchy: see docs/sdk-architecture.md Section 7.
Pagination
List endpoints return a PageIterator that auto-fetches pages as you
iterate. No manual cursor management required.
# Iterate over all items (pages fetched lazily)
for scan in client.recon.scans.list():
print(scan.domain)
# Filter by status
from sika.recon.models import ScanStatus
for scan in client.recon.scans.list(status=ScanStatus.completed):
print(f"{scan.domain} completed at {scan.completed_at}")
# Iterate page-by-page
for page in client.recon.scans.list().pages():
print(f"{page.count} items, next_token={page.next_token}")
for scan in page.items:
print(scan.domain)
A safety limit of 10,000 items prevents unbounded iteration. The
PageIterator accepts a max_items parameter to override this.
See docs/sdk-architecture.md Section 8 for details.
Development
make venv # Create virtualenv and install dev dependencies
make lint # Run ruff + mypy
make format # Auto-format with ruff
make test # Run unit tests
make check # lint + test (pre-push gate)
make build # Build sdist + wheel
make clean # Remove venv, build artifacts, caches
make ci-status # Wait for GitHub Actions and report pass/fail
Releasing
Releases are published to PyPI automatically when a version tag is pushed:
# Update version in src/sika/_version.py, then:
git tag v0.1.0
git push origin v0.1.0
The publish workflow builds sdist + wheel and publishes via
trusted publishing (OIDC).
No API tokens required.
Project Structure
src/sika/ SDK package (published as sika-sdk)
cli/sika_cli/ CLI package (published as sika-sdk[cli])
tests/unit/ Unit tests (mirrors source tree)
tests/integration/ Integration tests (live API)
docs/ Architecture docs
pm/ Roadmap, active plan, dev processes
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 sika_sdk-0.1.0.tar.gz.
File metadata
- Download URL: sika_sdk-0.1.0.tar.gz
- Upload date:
- Size: 32.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf29ff80cbe305ec88334679bfb9db9fc4c6c6f89011e6e44db46e120e87434d
|
|
| MD5 |
36b88a1005d9211e68fa147bbea09673
|
|
| BLAKE2b-256 |
f580ef3ce793feef4802c3e1f18302de1cf158a8f7e6a19c829d79f91a3f6466
|
Provenance
The following attestation bundles were made for sika_sdk-0.1.0.tar.gz:
Publisher:
publish.yml on Sika-Security/sika-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sika_sdk-0.1.0.tar.gz -
Subject digest:
cf29ff80cbe305ec88334679bfb9db9fc4c6c6f89011e6e44db46e120e87434d - Sigstore transparency entry: 1109288222
- Sigstore integration time:
-
Permalink:
Sika-Security/sika-python@b044d81a012bdcbd61736f52362a542391002d24 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Sika-Security
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b044d81a012bdcbd61736f52362a542391002d24 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sika_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sika_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 39.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7d6178ccb17390f8ed5e285fb11b630e2f8be0bbd010a802a3510b6d14280af
|
|
| MD5 |
1d83842353b2259116412cc728864cf8
|
|
| BLAKE2b-256 |
226706ac766aa7c72b8bdda39fb8ffef7bdd623d562207bb0085fd534c2a806c
|
Provenance
The following attestation bundles were made for sika_sdk-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Sika-Security/sika-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sika_sdk-0.1.0-py3-none-any.whl -
Subject digest:
a7d6178ccb17390f8ed5e285fb11b630e2f8be0bbd010a802a3510b6d14280af - Sigstore transparency entry: 1109288226
- Sigstore integration time:
-
Permalink:
Sika-Security/sika-python@b044d81a012bdcbd61736f52362a542391002d24 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Sika-Security
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b044d81a012bdcbd61736f52362a542391002d24 -
Trigger Event:
push
-
Statement type: