chore: добавлено логгирование
This commit is contained in:
1 parent
638c7a9618
commit
c0d2d98911
1 file changed
+7
-1
+7
-1
@@ -1,4 +1,5 @@
|
||||
import json
|
||||
import logging
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
@@ -18,6 +19,9 @@ from ua_parser import user_agent_parser
|
||||
from engine import actions
|
||||
from engine.schemas import SolveRequest
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.setLevel(logging.DEBUG)
|
||||
logger.addHandler(logging.StreamHandler())
|
||||
BROWSER_SLOTS = 10
|
||||
|
||||
IDENTITY_FILE = Path("identity.json")
|
||||
@@ -76,6 +80,7 @@ async def solve(
|
||||
response: Response,
|
||||
session_id: Annotated[str | None, Cookie()] = None
|
||||
):
|
||||
logger.info("Incoming payload: %s", payload)
|
||||
global BROWSER_SLOTS
|
||||
|
||||
if BROWSER_SLOTS <= 0:
|
||||
@@ -107,7 +112,7 @@ async def solve(
|
||||
# "timezone": payload.time_zone
|
||||
}
|
||||
|
||||
config = load_or_create_identity(user_data_dir, payload.user_agent, **ctx_opts)
|
||||
config = load_or_create_identity(user_data_dir, user_agent=payload.user_agent, **ctx_opts)
|
||||
|
||||
ctx_opts = {**config["context_options"], "config": config["config"]}
|
||||
async with AsyncCamoufox(
|
||||
@@ -115,6 +120,7 @@ async def solve(
|
||||
user_data_dir=user_data_dir,
|
||||
proxy=proxy,
|
||||
window=scr_size,
|
||||
i_know_what_im_doing=True,
|
||||
**ctx_opts,
|
||||
) as camoufo:
|
||||
await camoufo.add_init_script(config["init_script"])
|
||||
|
||||
Reference in new issue
Block a user