Skip to main content

Sub-millisecond rule enforcement engine — Python SDK

Project description

acrossed — Python SDK

Sub-millisecond rule enforcement for Flask, FastAPI, Django, and any Python backend.

Install

pip install acrossed
pip install "acrossed[async]"  # for asyncio / aiohttp

Quick start

from acrossed import Acrossed

ac = Acrossed(
    api_key="ack_live_...",
    signing_secret="acsk_...",
)

d = ac.check(ip="203.0.113.1", method="POST", path="/login")
if d.deny:
    print("blocked:", d.reason)

Flask

from flask import Flask, request, abort
from acrossed import Acrossed

ac = Acrossed(api_key="ack_live_...", signing_secret="acsk_...")
app = Flask(__name__)

@app.before_request
def gate():
    d = ac.check_request(request)
    if d.deny:
        abort(403, description=d.reason)

FastAPI (async)

from fastapi import FastAPI, Request, HTTPException
from acrossed import AsyncAcrossed

ac = AsyncAcrossed(api_key="ack_live_...", signing_secret="acsk_...")
app = FastAPI()

@app.middleware("http")
async def gate(req: Request, call_next):
    d = await ac.check_request(req)
    if d.deny:
        raise HTTPException(status_code=403, detail=d.reason)
    return await call_next(req)

Fails open by default. Use fail_closed=True for stricter postures.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

acrossed-1.0.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for acrossed-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c25944133f784b5befffc76d83fca66d598d169d115d028f4ad1dbb4ec02100
MD5 a2b680281a5bad972e14aa0e013411c1
BLAKE2b-256 5be63e8b6b63e0a62570b53eb4ef04284dc5ba8f2bc2cbd616c86f4a8c99183f

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