chore: добавил парсинг запроса
This commit is contained in:
1 parent
522091b084
commit
0602d89012
3 files changed
+47
-4
No files matched your search
@@ -72,7 +72,7 @@ X-API-Key: <key>
|
|||||||
],
|
],
|
||||||
"proxy": "socks5://user:pass@host:port",
|
"proxy": "socks5://user:pass@host:port",
|
||||||
"screen": "1280x920",
|
"screen": "1280x920",
|
||||||
"user-agent": "Firefox",
|
"user_agent": "Firefox",
|
||||||
"timeout": 120
|
"timeout": 120
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
+22
-3
@@ -1,4 +1,23 @@
|
|||||||
from fastapi import FastAPI
|
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()
|
app = FastAPI()
|
||||||
|
|
||||||
@@ -8,6 +27,6 @@ async def root():
|
|||||||
return {"message": "Hello World"}
|
return {"message": "Hello World"}
|
||||||
|
|
||||||
|
|
||||||
@app.get("/hello/{name}")
|
@app.post("/v1/solve")
|
||||||
async def say_hello(name: str):
|
async def solve(payload: SolveRequest):
|
||||||
return {"message": f"Hello {name}"}
|
return {"message": payload.model_dump(exclude_none=True)}
|
||||||
@@ -9,3 +9,27 @@ GET http://127.0.0.1:8000/hello/User
|
|||||||
Accept: application/json
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
###
|
||||||
Reference in new issue
Block a user