{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreifd5mk333q5ui2er4dgpl4nuab6wzmwqx34cymosbgbydix4mwdhy",
"uri": "at://did:plc:qllwm7os6w6f6hxue4mcr7mz/app.bsky.feed.post/3mcfi4hxyowl2"
},
"coverImage": {
"$type": "blob",
"ref": {
"$link": "bafkreieisjzlcmzjywhbyuuolznkqij3yovrm7wvdpirfteymrll6oi2fu"
},
"mimeType": "image/jpeg",
"size": 85702
},
"description": "The Arcjet Python SDK allows you to implement rate limiting, bot detection, email validation, and signup spam prevention in FastAPI and Flask style applications.",
"path": "/introducing-the-arcjet-python-sdk-beta/",
"publishedAt": "2026-01-14T16:22:42.000Z",
"site": "https://blog.arcjet.com",
"tags": [
"Arcjet",
"our Python SDK",
"FastAPI",
"Flask",
"Sign up for a free trial",
"@router.get"
],
"textContent": "Arcjet helps developers implement critical security protections against bots and signup spam. Directly integrated into your codebase, the Arcjet SDK provides building blocks to build security as just another feature, wherever you run and deploy your application.\n\nWe started with support for JavaScript and TypeScript applications because JS is the most popular language, particularly for new applications. However, it's a fairly modern pattern for applications to be built as a single codebase in a single language. It's very common to use JS for web application frontends, but often the backend is written in something else.\n\nWe get a lot of requests for support for additional languages, with Python being the most popular. Django is a particular driver of this given its popularity for web applications and APIs, but AI use cases have accelerated Python's popularity.\n\nSo that's why our next SDK is for Python! Available today in beta, our Python SDK supports both FastAPI (asynchronous) and Flask (synchronous) style APIs. It's open source and we have example applications for both FastAPI and Flask.\n\nFor example, with FastAPI you can protect your routes from common bots e.g. as part of a signup form:\n\n\n from arcjet import Mode, detect_bot\n from fastapi import APIRouter, Request\n from fastapi.responses import JSONResponse\n\n from app.arcjet import arcjet_with_rule\n\n arcjet = arcjet_with_rule(\n [\n # Shield protects your app from common attacks e.g. SQL injection\n detect_bot(\n # configured with a list of bots to allow from\n # https://arcjet.com/bot-list\n allow=[], # blocks all automated clients\n mode=Mode.LIVE, # will block requests. Use \"DRY_RUN\" to log only\n ),\n ]\n )\n\n router = APIRouter()\n\n\n @router.get(\"/bots\", name=\"Bot protection\")\n async def bots(request: Request):\n \"\"\"\n All automated clients will receive a 403 response. `curl` is considered an\n automated client by default so you can test it by clicking \"Try it out\"\n below and alternating between testing it in your browser running the `curl`\n command from your terminal.\n\n Learn more about Arcjet Bot protection in the [Arcjet docs](https://docs.arcjet.com/bot-protection/).\n \"\"\"\n\n decision = await arcjet.protect(request)\n\n print(decision, flush=True)\n\n if decision.is_denied():\n if decision.reason.is_bot():\n return JSONResponse(\n {\"message\": \"No bots allowed\"},\n status_code=403,\n )\n\n # If the request was denied for any other reason, return a 403 Forbidden\n return JSONResponse(\n {\"message\": \"Forbidden\"},\n status_code=403,\n )\n\n if decision.is_error():\n # Fail open to prevent an Arcjet error from blocking all requests. You\n # may want to fail closed if this route is very sensitive\n print(f\"Arcjet error: {decision.error}\", flush=True)\n\n return JSONResponse({\"message\": \"Hello world!\"})\n\nThe Python SDK supports core application-layer protections, including rate limiting, bot detection, email validation, and signup spam prevention. Protections are evaluated using Arcjet's contextual decision engine and applied as part of normal request handling, allowing teams to tailor behavior based on user activity, request patterns, and application-specific signals.\n\nOur JS SDK is approaching a stable release so we're excited to be able to bring Arcjet to other languages, starting with Python!\n\nSign up for a free trial to get started today.",
"title": "Introducing the Arcjet Python SDK beta",
"updatedAt": "2026-05-01T08:26:26.562Z"
}