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.0.0.tar.gz (18.2 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.0.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kepler_insights-1.0.0.tar.gz
  • Upload date:
  • Size: 18.2 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.0.0.tar.gz
Algorithm Hash digest
SHA256 fb113b9cf2305c6a21e5aa9b12b949cdf40078775e7da8e920b27be4b95b3d22
MD5 5b1529e13313499ab6903f663bcc9161
BLAKE2b-256 26dea87124558e5464b94025bb9704fb53043fcff08bf26b83442117fe11a7e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kepler_insights-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 05889e18fb3f5da7eb6e8c6846cb013041a67655eb97ba651f378177510e1540
MD5 12701615a23f9851aaa5186f1a105a63
BLAKE2b-256 a51c21cbb7159f1f00214eaf875f58f1012a0d14042aeffbed0b3f4cddec8a68

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