Add PUT/PATCH/DELETE/HEAD, full aiohttp/httpx param parity, screenshots,

async-with tab claiming, and full documentation

- get/post/put/patch/delete/head now accept the same request shape as
  aiohttp/httpx: data/json/files/cookies/auth/allow_redirects/
  follow_redirects/max_redirects, plus the existing session= for named
  cookie-persisting contexts.
- screenshot(url, path=None) captures a PNG, saved to disk or returned
  as base64.
- `async with stealth as page` claims a tab directly, task-safe for
  concurrent use on one shared instance (keyed off asyncio.current_task,
  not instance state).
- Strip all docstrings/comments from the source (author line excepted),
  per house style.
- README.md rewritten as the complete documentation: rationale, JA3/JA4
  comparison, dependencies, construction/laziness/lifetime, every method
  with examples, named sessions, configuration, error handling, testing.
- STEALTH_PATCHES.md: a literal, patch-by-patch account of every launch
  argument and JS patch applied, with rationale and verification method.
- 20 new tests: full HTTP-method coverage, cookies, auth, multipart,
  download, render, screenshot, named-session isolation, retry/error
  paths, and guaranteed page/context cleanup under exception.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0116i7dYLNZTXNR7Lqf439bV
This commit is contained in:
2026-09-09 13:56:28 +02:00
co-authored by Claude Sonnet 5
parent a3bb7639d2
commit 86c3a95cb8
7 changed files with 540 additions and 225 deletions
-7
View File
@@ -7,9 +7,6 @@ from stealthii import Stealthii
@pytest.mark.online
@pytest.mark.asyncio
async def test_sannysoft_detection_suite_is_clean():
"""Regression guard: every check on bot.sannysoft.com must pass under
our stealth patches. If this starts failing, a Chromium upgrade likely
changed something the STEALTH_INIT_JS patches assume."""
s = Stealthii()
try:
async with s.page() as pg:
@@ -29,8 +26,6 @@ async def test_sannysoft_detection_suite_is_clean():
@pytest.mark.online
@pytest.mark.asyncio
async def test_async_with_instance_claims_isolated_concurrent_tabs():
"""`async with stealth as pg` must behave like `stealth.page()`, and be
safe to use concurrently from multiple tasks on one shared instance."""
import asyncio
s = Stealthii()
@@ -50,8 +45,6 @@ async def test_async_with_instance_claims_isolated_concurrent_tabs():
@pytest.mark.online
@pytest.mark.asyncio
async def test_fast_path_uses_real_chromium_fingerprint():
"""The no-tab get()/post() fast path must carry a genuine Chromium TLS
fingerprint, distinct from a plain Python HTTP stack's."""
s = Stealthii()
try:
info = await s.fingerprint_info()