Skip to main content

Official Python client for the SightRadar face recognition API

Project description

SightRadar — Python client

Official Python client for the SightRadar face recognition API. Zero runtime dependencies (built on the standard library).

pip install sightradar

Authenticate

Create an API key in the console, then pass it directly or via the SIGHTRADAR_API_KEY environment variable.

from sightradar import SightRadar

sr = SightRadar(api_key="frs_...")   # or: SightRadar() with SIGHTRADAR_API_KEY set

Core workflow

# 1. Create a collection to hold faces.
sr.create_collection("event-2026")

# 2. Index faces from photos (URL, GCS key, or a local file).
sr.index("event-2026", url="https://example.com/group.jpg")
sr.index("event-2026", file="/path/to/photo.jpg", photo_id="img-42")

# 3. Search the collection with one selfie.
result = sr.search("event-2026", url="https://example.com/selfie.jpg")
if result.found:
    for m in result.matches:
        print(m.photo_id, round(m.similarity, 3))
else:
    print("no match:", result.reason)

Stateless operations (nothing stored)

# Detect + quality-gate faces in an image.
det = sr.detect(url="https://example.com/photo.jpg")
print(det.detected_face_count, det.gated_face_count)

# 1:1 verification between two faces.
cmp = sr.compare(
    source_url="https://example.com/a.jpg",
    target_url="https://example.com/b.jpg",
)
print(cmp.match, cmp.similarity)

Account

print(sr.wallet().balance_credits)
print(sr.usage(days=30))

Errors

Every non-2xx response raises a typed exception:

from sightradar import (
    SightRadarError,            # base
    AuthenticationError,        # 401
    InsufficientCreditsError,   # 402
    NotFoundError,              # 404
    RateLimitError,             # 429
)

try:
    sr.describe_collection("missing")
except NotFoundError as e:
    print(e.status_code, e.message)

Image inputs

Index / search / detect / register-selfie accept exactly one image source:

  • url= — a public image URL
  • gcs_key= — a Google Cloud Storage object key
  • file= — a local path, bytes, or a file-like object (uploaded as multipart)

search additionally accepts embedding= (a 512-d vector).

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

sightradar-1.0.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

sightradar-1.0.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file sightradar-1.0.0.tar.gz.

File metadata

  • Download URL: sightradar-1.0.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for sightradar-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b9856af1a504c10b4d60d1bb1298643c884c72c44f2b96a17f047c7c55163fb8
MD5 79dca25bac20fab1bf8615299e9d36b7
BLAKE2b-256 ecf01383f4ad4d682bc18b072bad34a019c44e74aa38b31ba752fbe0d50e0c71

See more details on using hashes here.

File details

Details for the file sightradar-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sightradar-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for sightradar-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76b3e9869c526cfd784cf99c3310b698b4137e622b471f402470f05a7afe42fb
MD5 60b6b82a6a777325dd72068ce07cdc19
BLAKE2b-256 ebc3c1ae31a4acf6709ed01f00d7820c221785169c267591911661910e8b07e1

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