build: лимиты ресурсов, прокси и нагрузочный тест; docs: API

- docker-compose: cpus/mem_limit через API_CPUS/API_MEM_LIMIT, прокси gost в профиле loadtest
- tests/loadtest.py: параллельные запросы к /v1/solve + пики docker stats
- docs/API.md: справочник по запросу, действиям, ответу и сессиям
- docs/Deployment.md: результаты замеров и правило подбора BROWSER_SLOTS

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
protokeyandClaude Opus 5.5 committed 2026-10-12 13:55:36 +04:00
1 parent df108dae3f
commit a319b81d8b
6 files changed
+330 -105

No files matched your search

+12 -50
View File
@@ -57,27 +57,20 @@ requirements.txt
env.example
```
## API (draft)
## API
```
POST /v1/solve
X-API-Key: <key>
{
"captcha": "token",
"url": "https://example.com/login",
"url": "https://freelancehunt.com/projects",
"proxy": "http://user:pass@host:port",
"captcha_type": "cloudflare",
"actions": [
{"type": "fill", "selector": "#email", "value": "user@example.com"},
{"type": "fill", "selector": "#password", "value": "..."},
{"type": "mouse_move", "selector": "#submit"},
{"type": "click", "selector": "#submit"},
{"type": "wait_for", "selector": ".dashboard", "timeout": 30}
{"type": "wait_for", "selector": "a[href*=\"/project/\"]", "timeout": 60}
],
"proxy": "socks5://user:pass@host:port",
"screen": "1280x920",
"user_agent": "Mozilla/5.0 (...) Chrome/...",
"timeout": 120
"html": true
}
```
@@ -85,46 +78,15 @@ Response:
```json
{
"ok": false,
"context": "000000",
"error": "action_error",
"html": "<html>...</html>",
"cookies": [
{
"name": "session",
"value": "..."
}
],
"actions_result": [
{
"type": "fill",
"ok": true
},
{
"type": "fill",
"ok": true
},
{
"type": "click",
"ok": true
},
{
"type": "wait_for",
"ok": false,
"error": "Element not located"
}
]
"status": "ok",
"user_agent": "Mozilla/5.0 (...) Chrome/155.0.0.0 Safari/537.36",
"cookies": [{"name": "cf_clearance", "value": "..."}],
"actions": [{"type": "wait_for", "ok": true}],
"html": "<head>...</head><body>...</body>"
}
```
On failure, `status` is `"error"` and `error` carries a machine-readable reason (`selector_not_found`, `timeout`,
`navigation_failed`, ...).
Fill команда включает 3 действия
1. `{"type": "mouse_move", "selector": "#email"},` - навести мышку на элемент
2. `{"type": "click"},` - клик в текущие координаты
3. `{"type": "typing", "value": "user@example.com"},` - набор текста
Full reference — fields, action types, error formats, sessions: [docs/API.md](docs/API.md).
## Roadmap