Skip to main content

The official Python library for Sherlockeye

Project description

sherlockeye: The official Python library for Sherlockeye

Sherlockeye is a reverse search engine for investigations, fraud prevention, threat intelligence, and broader digital risk analysis.

This library lets you integrate Sherlockeye’s multi-source reverse search capabilities into your own Python applications — run OSINT searches (email, phone, username, domain, IP and more).

Get your API KEY

https://app.sherlockeye.io/api

Full API documentation: https://docs.sherlockeye.io

Quick start

from sherlockeye import SherlockeyeClient

client = SherlockeyeClient(api_key="YOUR_API_KEY")

# Check your token balance
balance = client.get_balance()
print(balance["data"]["tokens"])

# Run a synchronous search (waits for results up to timeoutSeconds)
sync_result = client.create_sync_search(
    {
        "type": "email",
        "value": "someone@example.com",
        "timeoutSeconds": 60,
    }
)
print(sync_result["data"]["status"], sync_result["data"]["results"])
import time
from sherlockeye import SherlockeyeClient

client = SherlockeyeClient(api_key="YOUR_API_KEY")

# Run an asynchronous search (fire-and-forget style, then poll)
search = client.create_search(
    {
        "type": "email",
        "value": "someone@example.com",
    }
)

search_id = search["data"]["searchId"]
status = search["data"]["status"]  # usually "processing"
print("Created search:", search_id, status)

# Poll until the search is complete (or a max number of attempts)
max_attempts = 10
attempt = 0

while status != "complete" and attempt < max_attempts:
    attempt += 1
    search_details = client.get_search(search_id)
    status = search_details["data"]["status"]
    print(f"[attempt {attempt}] status:", status)
    if status != "complete":
        time.sleep(5)  # wait 5 seconds before polling again

results = search_details["data"].get("results", [])
print("Final status:", status)
print("Results:", results)

Installation

pip install sherlockeye

For local development in this repository:

pip install -e .

Basic usage

from sherlockeye import SherlockeyeClient

client = SherlockeyeClient(api_key="YOUR_API_KEY")

# Token balance
balance = client.get_balance()
print(balance["data"]["tokens"])

# Synchronous search
sync_result = client.create_sync_search(
    {
        "type": "ip",
        "value": "1.1.1.1",
        "timeoutSeconds": 60,  # Maximum time (in seconds) to wait for results
    }
)

status = sync_result["data"]["status"]
results = sync_result["data"]["results"]
print(status, results)

if status == "processing":
    search_id = sync_result["data"]["searchId"]
    print(
        "Warning: search is still processing. "
        "More results may become available over time. "
        f"You can poll its status and results later using get_search('{search_id}') "
    )

# Asynchronous search
search = client.create_search(
    {
        "type": "email",
        "value": "someone@example.com",
    }
)
print(search["data"]["searchId"])

Webhooks

# Create webhook
webhook = client.create_webhook(
    {
        "url": "https://YOUR_DOMAIN/webhooks/sherlockeye",
        "events": ["search.completed"],
        "enabled": True,
    }
)

# List webhooks
all_webhooks = client.list_webhooks()

# Delivery history
deliveries = client.get_webhook_deliveries(webhook["data"]["id"])

Error handling

All API failures raise subclasses of SherlockeyeError:

from sherlockeye import (
    SherlockeyeClient,
    SherlockeyeError,
    SherlockeyeAuthError,
    SherlockeyeRateLimitError,
    SherlockeyeValidationError,
)

client = SherlockeyeClient(api_key="YOUR_API_KEY")

try:
    balance = client.get_balance()
except SherlockeyeAuthError:
    print("Invalid API key or not allowed.")
except SherlockeyeRateLimitError:
    print("Rate limit or credits exceeded.")
except SherlockeyeValidationError as exc:
    print("Validation error:", exc)
except SherlockeyeError as exc:
    print("Generic Sherlockeye API error:", exc)

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

sherlockeye-0.1.1.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

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

sherlockeye-0.1.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file sherlockeye-0.1.1.tar.gz.

File metadata

  • Download URL: sherlockeye-0.1.1.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for sherlockeye-0.1.1.tar.gz
Algorithm Hash digest
SHA256 049da5d513f1d125b3efa2c79e722a1536cdccf11e12109a1058fc2abf4f5102
MD5 269b5b2732766be40f2e117a8ca3e341
BLAKE2b-256 189e50b46731efdf1eaadfbadd0688a02def4b936cbbbc726105d84ad35a2a9d

See more details on using hashes here.

File details

Details for the file sherlockeye-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: sherlockeye-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for sherlockeye-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 80ad462522b5274d19c3b4b4b442d31a4eb21344cdf885bd93d9886d170590b5
MD5 56a948f36e7a1f7fc5e74baf23bbc319
BLAKE2b-256 0ab731cd65b67f196e65907d777cd61e482539d5a97f8024f03e1f9896af3825

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