mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-22 23:31:12 +02:00
chore: linting
This commit is contained in:
parent
be35eb8743
commit
c0ebb62fb2
20 changed files with 158 additions and 125 deletions
|
|
@ -29,8 +29,7 @@ import re
|
|||
import time
|
||||
from typing import Any
|
||||
|
||||
from app.utils.captcha import CaptchaConfig
|
||||
from app.utils.captcha import solvers
|
||||
from app.utils.captcha import CaptchaConfig, solvers
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
|||
|
|
@ -42,8 +42,10 @@ from urllib.parse import urlsplit, urlunsplit
|
|||
|
||||
from scrapling.fetchers import AsyncFetcher
|
||||
|
||||
from app.proprietary.platforms.google_search import captcha as _captcha
|
||||
from app.proprietary.platforms.google_search import pool_store as _store
|
||||
from app.proprietary.platforms.google_search import (
|
||||
captcha as _captcha,
|
||||
pool_store as _store,
|
||||
)
|
||||
from app.utils.captcha import captcha_enabled, get_captcha_config
|
||||
from app.utils.proxy import get_proxy_url
|
||||
|
||||
|
|
@ -374,9 +376,8 @@ def _make_page_action(proxy: str | None, cfg):
|
|||
"""
|
||||
|
||||
async def page_action(page):
|
||||
if _captcha.on_sorry(page):
|
||||
if await _captcha.solve_sorry(page, proxy, cfg):
|
||||
_exemption_jar[proxy or ""] = await _captcha.exemption_cookies(page)
|
||||
if _captcha.on_sorry(page) and await _captcha.solve_sorry(page, proxy, cfg):
|
||||
_exemption_jar[proxy or ""] = await _captcha.exemption_cookies(page)
|
||||
return await _expand_blocks(page)
|
||||
|
||||
return page_action
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ never block the request loop and don't care which loop the caller is on.
|
|||
|
||||
``ponytail:`` the shared store holds only exemptions (the costly artifact), not
|
||||
per-process render concurrency — global per-IP load is still governed by each
|
||||
process's local per-IP cap × the number of processes, so size the pool for the
|
||||
process's local per-IP cap x the number of processes, so size the pool for the
|
||||
fleet (see ``GOOGLE_SEARCH_WARM_POOL_TARGET``). Full distributed inflight
|
||||
accounting is the upgrade path if a single shared IP ever gets overloaded.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -299,11 +299,10 @@ def _is_unrecoverable(exc: Exception) -> bool:
|
|||
"""True for solver errors that must latch solving off.
|
||||
|
||||
Covers the in-house seam's typed errors (``SolverBalanceError`` /
|
||||
``SolverAuthError`` / ``SolverUnsupported``) plus legacy/no-balance shapes.
|
||||
``SolverAuthError`` / ``SolverUnsupportedError``) plus legacy/no-balance shapes.
|
||||
Matched by class name so no solver module must be imported here.
|
||||
"""
|
||||
name = type(exc).__name__.lower()
|
||||
return any(
|
||||
k in name
|
||||
for k in ("balance", "apikey", "auth", "unsupported", "wronguser")
|
||||
k in name for k in ("balance", "apikey", "auth", "unsupported", "wronguser")
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue