chore: добавил парсинг запроса

This commit is contained in:
protokey committed 2026-09-08 16:56:56 +04:00
1 parent 522091b084
commit 0602d89012
3 files changed
+47 -4

No files matched your search

+1 -1
View File
@@ -72,7 +72,7 @@ X-API-Key: <key>
],
"proxy": "socks5://user:pass@host:port",
"screen": "1280x920",
"user-agent": "Firefox",
"user_agent": "Firefox",
"timeout": 120
}
```
+22 -3
View File
@@ -1,4 +1,23 @@
from fastapi import FastAPI
from pydantic import BaseModel
class ActionRequest(BaseModel):
type: str
selector: str | None = None
value: str | None = None
timeout: int | None = None
class SolveRequest(BaseModel):
url: str
proxy: str
actions: list[ActionRequest]
timeout: int | None = None
screen: str | None = None
user_agent: str | None = None
captcha: str | None = None
app = FastAPI()
@@ -8,6 +27,6 @@ async def root():
return {"message": "Hello World"}
@app.get("/hello/{name}")
async def say_hello(name: str):
return {"message": f"Hello {name}"}
@app.post("/v1/solve")
async def solve(payload: SolveRequest):
return {"message": payload.model_dump(exclude_none=True)}
+24
View File
@@ -9,3 +9,27 @@ GET http://127.0.0.1:8000/hello/User
Accept: application/json
###
POST http://127.0.0.1:8000/v1/solve
Accept: application/json
Content-Type: application/json
X-API-Key: <key>
{
"captcha": "token",
"url": "https://example.com/login",
"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}
],
"proxy": "socks5://user:pass@host:port",
"screen": "1280x920",
"user_agent": "Firefox",
"timeout": 120
}
###