Skip to main content

Official Python SDK for the Kepler Insights API — curated company-scoring intelligence over a 67-signal engine.

Project description

Kepler Insights — Python SDK

Official Python SDK for the Kepler Insights API — curated company-scoring intelligence over a 67-signal engine.

Install

pip install kepler-insights

Requires Python 3.10+. Depends on httpx and pydantic v2.

Quickstart

from kepler_insights import Kepler

with Kepler(api_key="ki_live_...") as client:
    score = client.score("stripe.com")
    print(f"{score.domain}: {score.ki_rating} ({score.composite_score:.1f})")
    print(f"  team: {score.buckets.team_structure:.1f}")
    print(f"  market: {score.buckets.market_position:.1f}")

Sandbox keys (ki_test_...) accept only the 4 canned domains — acme.test, unicorn.test, struggling.test, cohort.test. See the Sandbox guide.

API surface

Method Endpoint Returns
client.score(domain) POST /v1/score Score
client.get_score(domain) GET /v1/score/{domain} Score
client.start_score(domain) POST /v1/score?wait=false Job (Growth+)
client.get_job(job_id) GET /v1/jobs/{job_id} JobResponse
client.history(domain, limit=, cursor=) GET /v1/score/{domain}/history HistoryPage
client.iter_history(domain, max_records=) (auto-paginates) iterator of HistoryRecord
client.cohort(domain) GET /v1/company/{domain}/cohort Cohort
client.confidence(domain) GET /v1/company/{domain}/confidence Confidence
client.distribution() GET /v1/distribution Distribution
client.movers(window) GET /v1/movers Movers
client.signals() GET /v1/signals SignalsManifest
client.usage() GET /v1/usage Usage

Async cold scoring

Cold scoring takes 30–60 seconds. On Growth and above, you can start a job and poll without holding an HTTP connection open:

job = client.start_score("stripe.com")    # returns immediately
score = job.wait(timeout=180)             # blocks until complete; raises on timeout

If the API short-circuits to a cached-fresh response (no cold work needed), start_score returns a Job already in the complete state — wait() returns instantly. This mirrors Stripe's payment_intent "no action needed" pattern.

Error handling

Every error inherits from KeplerError. Branch on the specific subclass or the stable error.code string:

from kepler_insights import (
    Kepler,
    AuthError,
    ColdBudgetExhausted,
    FreeTierSandboxOnly,
    NotFound,
    RateLimitError,
    ScoringTimeout,
)

try:
    score = client.score("stripe.com")
except FreeTierSandboxOnly:
    print("Upgrade to Starter for live scoring.")
except ColdBudgetExhausted as e:
    print(f"Monthly cap hit. Resets in {e.retry_after}s. Upgrade for more.")
except RateLimitError as e:
    print(f"Rate limited. Retry in {e.retry_after}s.")
except ScoringTimeout:
    print("Cold scoring exceeded sync budget — use start_score() for async.")
except NotFound:
    print("Never scored. Trigger one with score(domain).")
except AuthError:
    print("Invalid or revoked API key.")

The SDK auto-retries on 5xx and network errors with exponential backoff (3 attempts by default). It never retries 4xx — those are caller errors.

Configuration

client = Kepler(
    api_key="ki_live_...",
    base_url="https://api.keplerinsights.us",   # override only for testing
    timeout=70.0,                                # per-request timeout (s)
    retries=3,                                   # 5xx retry attempts
)

For custom transports (proxies, mTLS, etc.) inject your own httpx.Client:

import httpx
custom = httpx.Client(timeout=120, transport=httpx.HTTPTransport(retries=0))
client = Kepler(api_key="ki_live_...", http_client=custom)

Development

git clone <repo>
cd Ki_dev/sdk-python
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest

License

MIT. The API itself is proprietary; the SDK wrapper is MIT-licensed so you can vendor it freely.

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

kepler_insights-1.1.0.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

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

kepler_insights-1.1.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file kepler_insights-1.1.0.tar.gz.

File metadata

  • Download URL: kepler_insights-1.1.0.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for kepler_insights-1.1.0.tar.gz
Algorithm Hash digest
SHA256 0de7d4b4f8d464c8fd7d3c93e196cbeaee9bd629244c63c25c45e623c4529485
MD5 32c67926bbd1ebc979b4c5b5ed9d30cc
BLAKE2b-256 c803e4c01e63d92b724005135c889f6fcf76cda57a98381b2f81657e7df21a84

See more details on using hashes here.

File details

Details for the file kepler_insights-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for kepler_insights-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e67d6250a068645bbaa27746ea57fb090ccd43607aa8a54d3229aeccc5363d3f
MD5 9bd67f8848ea8affdccb33088b253c2f
BLAKE2b-256 54a0dc8f318272034ad62769cef9d19430f900ad2b0899632fecf612ac9727c0

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