Back to SDKsView on GitHub
Python SDK
Pythonic SDK with type hints, async support, and framework integrations.
pip install coverkitInstallation
pip
pip install coverkitpoetry
poetry add coverkitQuick Start
import coverkit
from coverkit import CoverKit
# Initialize the client
client = CoverKit(
api_key="sk_live_your_api_key",
environment="production" # or "sandbox"
)
# Create a quote
quote = client.quotes.create(
product="shipping_protection",
coverage={
"item_value": 15000, # $150.00 in cents
"shipping_method": "ground"
},
customer={
"email": "customer@example.com"
}
)
print(f"Quote ID: {'{'}quote.id{'}'}")
print(f"Premium: {quote.premium / 100:.2f{'}'}")
# Bind the quote to create a policy
policy = client.policies.create(
quote_id=quote.id,
payment={
"method": "stripe",
"token": "tok_visa"
}
)
print(f"Policy ID: {'{'}policy.id{'}'}")
print(f"Status: {'{'}policy.status{'}'}") # "active"Async Support
import asyncio
from coverkit import AsyncCoverKit
async def main():
client = AsyncCoverKit(api_key="sk_live_your_api_key")
quote = await client.quotes.create(
product="shipping_protection",
coverage={"item_value": 15000}
)
print(f"Quote: {'{'}quote.id{'}'}")
asyncio.run(main())Features
Type Hints
Full type annotations for IDE autocompletion and type checking.
Async Support
Native async/await support for high-performance applications.
Django Integration
Django middleware and model mixins for seamless integration.
Pydantic Models
All responses are Pydantic models for easy validation.
Framework Integrations
Django
# settings.py
COVERKIT_API_KEY = "sk_live_your_api_key"
# views.py
from coverkit.django import get_coverkit_client
def create_quote(request):
client = get_coverkit_client()
quote = client.quotes.create(...)Flask
from flask import Flask
from coverkit.flask import CoverKitExtension
app = Flask(__name__)
coverkit = CoverKitExtension(app)
@app.route("/quote")
def create_quote():
quote = coverkit.client.quotes.create(...)