Skip to main content
The BlackSwan Python SDK lets you query on-chain credit data from any Python backend. This tutorial shows how to expose credit dashboard and eligibility endpoints using both Flask and FastAPI.

Install

Client Setup

Flask Backend

The Flask example below exposes two endpoints: one that returns the full credit dashboard for a wallet, and one that checks basic eligibility based on credit history and reputation:

FastAPI Backend

FastAPI’s async support pairs naturally with the SDK. The example below mirrors the Flask routes with typed Pydantic-style response models:

Understanding APR Values

APR values from the BlackSwan SDK are always integers expressed in basis points. To convert to a human-readable percentage, divide by 1000. A raw value of 142 equals 0.142%.