Python SDK for the Scrift brand asset API
Project description
scrift
Python SDK for the Scrift brand asset API. Fetch brand colours, SVG logos, raster exports, and metadata for thousands of companies - one API call at a time.
Installation
pip install scrift
Quick start
from scrift import Scrift
with Scrift(api_key="scrf_...") as client:
# Look up a single brand
brand = client.catalog.get("stripe")
print(brand.name, brand.brand_color) # Stripe 635BFF
print(brand.rate_limit) # RateLimitInfo from X-RateLimit-* headers (or None)
# List the catalog
page = client.catalog.list(limit=10)
for item in page.items:
print(item.slug)
# Batch lookup (up to 50 slugs)
batch = client.catalog.batch(["stripe", "github", "vercel"])
print(batch.found, batch.not_found)
# Search by name
results = client.catalog.search("stripe")
for match in results.matches:
print(match.slug, match.name)
# Fetch an SVG logo
svg_bytes = client.svg.get("stripe", variant="dark")
# PNG / WebP (size is an API-defined enum, e.g. 32 … 512)
png_bytes = client.raster.get_png("stripe", size=128, variant="mono")
webp_bytes = client.raster.get_webp("stripe", size=256)
# Look up a brand by domain
info = client.brand.get("stripe.com")
print(info.variants) # ['color', 'mono', 'wordmark']
Method reference
| Method | Description |
|---|---|
client.catalog.get(slug) |
Single brand by slug |
client.catalog.list(limit=, offset=) |
Paginated catalog list |
client.catalog.batch(slugs) |
Batch lookup (max 50) |
client.catalog.search(query, limit=) |
Search by name (min 2 chars) |
client.svg.get(slug, variant=) |
Raw SVG bytes |
client.raster.get_png(slug, size=, variant=) |
Raw PNG bytes |
client.raster.get_webp(slug, size=, variant=) |
Raw WebP bytes |
client.brand.get(domain) |
Brand lookup by domain |
SVG variants
mono, color, dark, light, wordmark, icon
Error handling
from scrift import Scrift, NotFoundError, RateLimitError
with Scrift(api_key="scrf_...") as client:
try:
brand = client.catalog.get("nonexistent")
except NotFoundError as e:
print(e.error_code) # service_not_found
except RateLimitError as e:
print(f"Retry after {e.retry_after}s")
All exceptions inherit from ScriftError and carry status_code, error_code, and message.
| Exception | HTTP status |
|---|---|
AuthenticationError |
401 |
NotFoundError |
404 |
ValidationError |
422 |
RateLimitError (ScriftRateLimitError) |
429 (auto-retries once, capped at 30s) |
APIError |
everything else |
Links
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scrift-0.2.2.tar.gz.
File metadata
- Download URL: scrift-0.2.2.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2ded2ef793b7c4a8e03cc080437a087e0a60499b5324f15e24735bda5afacf3
|
|
| MD5 |
da649bd280359e77ef3ea0f81d360cba
|
|
| BLAKE2b-256 |
a3c6cee1a806d72fbbc9baae478144d586f4f965ffc2e0e93df1e357072f9da0
|
File details
Details for the file scrift-0.2.2-py3-none-any.whl.
File metadata
- Download URL: scrift-0.2.2-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad56828a9637c28183e040c6fbea93ead7a538da3d044f8115786d6c3a20bb4a
|
|
| MD5 |
fccb30db3f319ed9c341cfa17c3281a8
|
|
| BLAKE2b-256 |
679c7aac00878a6be62eaccb8cc63a11ca80b3bf0965429c44c2a23a38220ed1
|