SDKs
Python

Python SDK

The official Orsa Python SDK.

Installation

pip install orsa

Requirements: Python 3.8+

Quick Start

from orsa import Orsa
 
client = Orsa(api_key="orsa_live_...")
 
brand = client.brand.retrieve(domain="stripe.com")
print(brand.name)       # "Stripe"
print(brand.colors)     # ["#635BFF", "#0A2540", "#00D4AA"]

Configuration

client = Orsa(
    api_key="orsa_live_...",                # Required
    base_url="https://api.orsa.dev",        # Optional
    timeout=30,                              # Optional: seconds
    max_retries=3,                           # Optional
)
OptionTypeDefaultDescription
api_keystrYour Orsa API key (required)
base_urlstrhttps://api.orsa.devAPI base URL
timeoutint30Request timeout in seconds
max_retriesint3Max retries on transient errors

Namespaces

client.brand — Brand Intelligence

# Full brand data
brand = client.brand.retrieve(domain="stripe.com")
 
# Simplified (faster)
simple = client.brand.retrieve_simplified(domain="stripe.com")
 
# By company name
brand = client.brand.retrieve_by_name(name="Stripe")
 
# By email
brand = client.brand.retrieve_by_email(email="support@stripe.com")
 
# By stock ticker
brand = client.brand.retrieve_by_ticker(ticker="AAPL")
 
# Screenshot
screenshot = client.brand.screenshot(
    domain="stripe.com",
    full_page=False,
    dark_mode=True,
)
print(screenshot.screenshot_url)
 
# Style guide
style = client.brand.styleguide(domain="stripe.com")
 
# Font detection
fonts = client.brand.fonts(domain="stripe.com")
 
# NAICS classification
naics = client.brand.naics(domain="stripe.com")
 
# Transaction identifier
txn = client.brand.transaction_identifier(
    transaction_info="STRIPE* ACME CORP",
    country_gl="US",
)

client.web — Web Scraping

# Raw HTML
html = client.web.scrape_html(url="https://example.com")
 
# Clean Markdown
md = client.web.scrape_markdown(url="https://example.com")
 
# Image extraction
images = client.web.scrape_images(url="https://example.com")
 
# Sitemap
sitemap = client.web.scrape_sitemap(domain="example.com")
 
# Full site crawl
crawl = client.web.crawl(
    url="https://example.com",
    max_pages=50,
    max_depth=3,
)
 
# Check crawl status
status = client.web.crawl_status(job_id=crawl.job_id)

client.ai — AI Extraction

# Natural language query
result = client.ai.query(
    domain="stripe.com",
    data_to_extract="pricing plans with features and prices",
)
 
# Extract products
products = client.ai.extract_products(domain="store.example.com")
 
# Single product
product = client.ai.extract_product(url="https://store.example.com/product/123")

Error Handling

from orsa import Orsa, OrsaError
 
try:
    brand = client.brand.retrieve(domain="invalid-domain")
except OrsaError as e:
    print(e.message)      # Human-readable message
    print(e.status_code)  # HTTP status code
    print(e.code)         # Error code

Async Support

from orsa import AsyncOrsa
 
client = AsyncOrsa(api_key="orsa_live_...")
 
brand = await client.brand.retrieve(domain="stripe.com")

Framework Examples

FastAPI

from fastapi import FastAPI
from orsa import Orsa
 
app = FastAPI()
orsa = Orsa(api_key=os.environ["ORSA_API_KEY"])
 
@app.get("/brand/{domain}")
async def get_brand(domain: str):
    brand = orsa.brand.retrieve(domain=domain)
    return brand.dict()

Django

from django.http import JsonResponse
from orsa import Orsa
 
orsa = Orsa(api_key=settings.ORSA_API_KEY)
 
def brand_view(request, domain):
    brand = orsa.brand.retrieve(domain=domain)
    return JsonResponse(brand.dict())

Note

The Python SDK is under active development. Not all endpoints may be available yet. Check the GitHub repository (opens in a new tab) for the latest status.