Stealth browser sessions for AI agents
Project description
shadey
Stealth browser sessions for AI agents. Pass Cloudflare, DataDome, PerimeterX, and Kasada from any IP.
Install
pip install shadey
Quick Start
import asyncio
from shadey import Shadey
async def main():
async with Shadey("sk_your_api_key") as client:
async with await client.session() as session:
# Navigate and extract — no CDP/Playwright needed
await session.goto("https://example.com")
title = await session.evaluate("document.title")
print(title["result"])
# Extract text from elements
headings = await session.extract("h1", all=True)
print(headings["data"])
# Get full page HTML
page = await session.content()
print(f"{page['length']} bytes")
# Screenshot
img = await session.screenshot() # base64 jpeg
asyncio.run(main())
With Behavioral Actions
async with Shadey("sk_your_api_key") as client:
async with await client.session() as session:
await session.goto("https://nowsecure.nl")
# Human-like interactions to build trust
await session.idle(duration_ms=3000)
await session.scroll(400)
await session.click(500, 300)
await session.type_text("hello world", context="search")
# Then extract what you need
result = await session.extract(".result-title", all=True)
With Playwright (CDP)
async with Shadey("sk_your_api_key") as client:
async with await client.session() as session:
# Full browser control via CDP
from playwright.async_api import async_playwright
async with async_playwright() as p:
browser = await p.chromium.connect_over_cdp(session.playwright_url)
page = browser.contexts[0].pages[0]
await page.goto("https://nowsecure.nl")
print(await page.title())
API
Shadey(api_key, base_url="https://api.shadey.dev")
Create a client. Use as async context manager or call .close() manually.
client.session(stealth="full", proxy=None, profile=None)
Create a stealth browser session. Returns a ShadeySession.
REST Actions
session.goto(url, wait_ms=3000)
Navigate to a URL. Waits for page load + extra wait_ms.
session.screenshot()
Returns a base64 JPEG data URI of the current page.
session.extract(selector, attribute="textContent", all=False)
Extract data from the page. Set all=True to get all matching elements.
session.evaluate(expression)
Run JavaScript and return the result.
session.content()
Get the full page HTML.
Behavioral Actions
session.click(x, y, width=50)
Move mouse and click at coordinates with Fitts' law timing and corrective submovements.
session.type_text(text, context="form")
Type text with QWERTY bigram-modeled keystroke timing. Context: "form", "search", "url".
session.scroll(distance)
Scroll with momentum and inertia. Positive = down, negative = up.
session.dwell(context="content")
Wait a human-realistic amount of time. Context: "content", "search", "form".
session.idle(duration_ms=5000)
Simulate idle browsing — mouse movements, scrolls, pauses driven by HMM behavioral model.
CDP Access
session.playwright_url / session.puppeteer_url
CDP WebSocket URL for direct browser control.
session.close()
Destroy the session.
client.usage()
Get plan usage stats.
client.health()
Check API health.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shadey-0.1.0.tar.gz.
File metadata
- Download URL: shadey-0.1.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aeb6b385432e9d1595d0981815f8803c729c559dbf6a6bd9465780595e7e67d6
|
|
| MD5 |
1fc3db484f6086630d1ee7e497ea4c4c
|
|
| BLAKE2b-256 |
4c4387a120c4b8b552fd4334905b9ea4c1d89b12a78345f36b0635f9c30cea49
|
File details
Details for the file shadey-0.1.0-py3-none-any.whl.
File metadata
- Download URL: shadey-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a34cdba160bce3327660523024c1425eca8dc58b5238a00ac2449e4f4cecafd
|
|
| MD5 |
15ff102578e07064a6baf7e45206a5af
|
|
| BLAKE2b-256 |
886c986b3dbba0e8c10a8789a4fe21c8b400068fa9dd540b393c197208828c5c
|