Skip to main content

Python client for the XposedOrNot API - Check for data breaches and exposed credentials

Project description

XposedOrNot Python Client

A Python client for the XposedOrNot API to check for data breaches and exposed credentials.

Installation

pip install xposedornot

Quick Start

from xposedornot import XposedOrNot

# Initialize the client
xon = XposedOrNot()

# Check if an email has been exposed
result = xon.check_email("test@example.com")
print(f"Found in {len(result.breaches)} breaches: {result.breaches}")

# Get detailed breach analytics
analytics = xon.breach_analytics("test@example.com")
print(f"Total exposures: {analytics.exposures_count}")
print(f"First breach: {analytics.first_breach}")

for breach in analytics.breaches_details:
    print(f"  - {breach.breach}: {breach.xposed_records} records")

# Get all known breaches
breaches = xon.get_breaches()
print(f"Total breaches in database: {len(breaches)}")

# Filter breaches by domain
adobe_breaches = xon.get_breaches(domain="adobe.com")

# Check if a password has been exposed (uses k-anonymity)
pwd_result = xon.check_password("password123")
print(f"Password exposed {pwd_result.count} times")

Features

  • Email Breach Check: Check if an email has been exposed in known data breaches
  • Breach Analytics: Get detailed analytics including metrics by industry, risk level, and year
  • Breach Database: Access the full database of known breaches with filtering
  • Password Check: Securely check passwords using k-anonymity (only hash prefix sent)
  • Rate Limiting: Built-in rate limiting (1 request/second) to respect API limits
  • Type Hints: Full type annotations for IDE support

API Reference

XposedOrNot Client

from xposedornot import XposedOrNot

# Basic initialization
xon = XposedOrNot()

# With options
xon = XposedOrNot(
    api_key="your-api-key",      # For authenticated endpoints
    timeout=30.0,                 # Request timeout in seconds
    rate_limit=True,              # Enable/disable rate limiting
)

# Use as context manager
with XposedOrNot() as xon:
    result = xon.check_email("test@example.com")

Methods

check_email(email: str) -> EmailBreachResponse

Check if an email has been exposed in data breaches.

result = xon.check_email("test@example.com")
print(result.breaches)  # ['Adobe', 'LinkedIn', ...]

breach_analytics(email: str) -> BreachAnalyticsResponse

Get detailed breach analytics for an email.

analytics = xon.breach_analytics("test@example.com")
print(analytics.exposures_count)      # Total exposures
print(analytics.breaches_count)       # Number of breaches
print(analytics.first_breach)         # Date of first breach
print(analytics.breaches_details)     # List of BreachDetails
print(analytics.metrics)              # BreachMetrics with industry, risk, etc.

get_breaches(domain: str = None) -> list[Breach]

Get all known breaches, optionally filtered by domain.

# All breaches
all_breaches = xon.get_breaches()

# Filter by domain
adobe = xon.get_breaches(domain="adobe.com")

check_password(password: str) -> PasswordCheckResponse

Check if a password has been exposed using k-anonymity.

result = xon.check_password("mypassword")
print(result.count)            # Times found in breaches
print(result.characteristics)  # Password traits

Error Handling

from xposedornot import (
    XposedOrNot,
    NotFoundError,
    RateLimitError,
    ValidationError,
)

xon = XposedOrNot()

try:
    result = xon.check_email("test@example.com")
except NotFoundError:
    print("Email not found in any breaches")
except RateLimitError:
    print("Rate limit exceeded, please wait")
except ValidationError as e:
    print(f"Invalid input: {e}")

Response Models

All responses are typed dataclasses:

  • EmailBreachResponse - Contains list of breach names
  • BreachAnalyticsResponse - Detailed analytics with metrics
  • BreachDetails - Individual breach information
  • BreachMetrics - Analytics breakdown
  • Breach - Breach database entry
  • PasswordCheckResponse - Password exposure data

Links

License

MIT License

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

xposedornot-0.1.1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

xposedornot-0.1.1-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for xposedornot-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d03bf3af30a2a17e7452f2a04427f9268e5a9e0108ff5d4b929477cb8f9a7d91
MD5 11db1fa3d91a55ad9b77b7bcc97d2a9e
BLAKE2b-256 8455fd90e2bd13446544ee7f7dc54b4f7a7af9bc172635e2d3284bad5cff29ea

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for xposedornot-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6604cb2e49ea7ff1c0a2145eff866ab122de5b3b1567c63a667810a16ac54443
MD5 e811d7533a9f672045f28e44b265ddcd
BLAKE2b-256 4e9c4560f23b597bbea96c34a3d36ae757df56fb3f40c24746ae5533351f19ab

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