fix(tradein/scraper-kit): точность докстринга http_proxies() про httpx-совместимость
All checks were successful
CI / changes (pull_request) Successful in 7s
CI Trade-In / changes (pull_request) Successful in 7s
CI Trade-In / frontend-checks (pull_request) Has been skipped
CI / backend-tests (pull_request) Has been skipped
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Has been skipped
CI Trade-In / backend-tests (pull_request) Successful in 1m35s
All checks were successful
CI / changes (pull_request) Successful in 7s
CI Trade-In / changes (pull_request) Successful in 7s
CI Trade-In / frontend-checks (pull_request) Has been skipped
CI / backend-tests (pull_request) Has been skipped
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Has been skipped
CI Trade-In / backend-tests (pull_request) Successful in 1m35s
code-reviewer отметил: httpx>=0.28 больше не принимает dict в proxies= (только одиночный proxy= строкой). Docstring ошибочно называл эту функцию "httpx-совместимой" — уточнено что это только для curl_cffi, чтобы будущий мигратор F4a-d не словил TypeError.
This commit is contained in:
parent
9b4cdf8ec6
commit
51e2e545b7
1 changed files with 5 additions and 1 deletions
|
|
@ -80,13 +80,17 @@ DOCUMENT_HEADERS: dict[str, str] = {
|
|||
|
||||
|
||||
def http_proxies(proxy_url: str | None) -> dict[str, str] | None:
|
||||
"""curl_cffi/httpx-совместимый `proxies=` dict из одного url.
|
||||
"""curl_cffi-совместимый `proxies=` dict из одного url.
|
||||
|
||||
`None`/пустая строка → `None` (прямое подключение — без прокси).
|
||||
|
||||
Извлечено из идентичной идиомы `{"http": url, "https": url} if url else None`,
|
||||
продублированной в avito/serp.py, avito/detail.py, avito/imv.py, cian/detail.py,
|
||||
cian/newbuilding.py (дважды), cian/session.py.
|
||||
|
||||
ВАЖНО: не для httpx — начиная с httpx 0.28 `Client`/`AsyncClient` больше не
|
||||
принимают dict в `proxies=` (только одиночный `proxy=` строкой). Не передавай
|
||||
этот dict в httpx-клиент — `TypeError`.
|
||||
"""
|
||||
return {"http": proxy_url, "https": proxy_url} if proxy_url else None
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue