Skip to main content

Python SDK for the Scrift brand asset API

Project description

scrift

License: MIT

Python SDK for the Scrift brand asset API. Fetch brand colours, SVG logos, 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="sk_live_...") as client:
    # Look up a single brand
    brand = client.catalog.get("stripe")
    print(brand.name, brand.brand_color)  # Stripe 635BFF

    # 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")

    # 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.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="sk_live_...") 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 429 (auto-retries once, capped at 30s)
APIError everything else

Links

License

MIT

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

scrift-0.1.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scrift-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file scrift-0.1.0.tar.gz.

File metadata

  • Download URL: scrift-0.1.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","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":null}

File hashes

Hashes for scrift-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fd14eb170992876625be2b4b9cd8f66b38b4059a0290d7f6d77de6329baf222f
MD5 486356cedeedd61d2aaae3dfa8f69aef
BLAKE2b-256 5eb5424328800eb904db5f38977071937e86ed1fd445bbc3fb6c6c07d8044f6d

See more details on using hashes here.

File details

Details for the file scrift-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: scrift-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","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":null}

File hashes

Hashes for scrift-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40e1c82bff39b82d7f296a31a01500f1c221906d8bb28ab85b48c7ead455d8ef
MD5 3a5bd912579577bade6c860fdac33dd6
BLAKE2b-256 2490191170ea1cb4643546e43e2a719972a0f155ba995a160e1cd43f79f53e14

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