fix: bump aioweb pin to v0.1.5 (seam-checked); narrow backend except
bump the aioweb dependency from the stale v0.1.0 to current v0.1.5 — seam-verified against v0.1.5's actual API (request_with_retries -> Response on success, falsy FailureResponse on failure, all four override seams present). backend raw_request catches narrowed from bare Exception to OSError (covers curl_cffi RequestException / noble TLSClientException) and re-raises ClientError/TimeoutError first, so a real bug isn't laundered into 'client error'. Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
parent
da8b0bf6f8
commit
ef9eb3010c
@ -8,7 +8,7 @@ version = "0.1.3"
|
|||||||
description = "TLS-fingerprinting backends (curl_cffi / noble_tls) for aioweb via one injectable TLSSession, config-free, installable."
|
description = "TLS-fingerprinting backends (curl_cffi / noble_tls) for aioweb via one injectable TLSSession, config-free, installable."
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aioweb @ git+ssh://git@git.rethinkstudios.io/rethink-public/aioweb.git@v0.1.0",
|
"aioweb @ git+ssh://git@git.rethinkstudios.io/rethink-public/aioweb.git@v0.1.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
|
|||||||
@ -60,7 +60,12 @@ def _coerce_timeout(value):
|
|||||||
|
|
||||||
|
|
||||||
def _jar_to_dict(session):
|
def _jar_to_dict(session):
|
||||||
"""best-effort map of a requests-style cookie jar on session to a plain dict"""
|
"""best-effort map of a requests-style cookie jar on session to a plain dict
|
||||||
|
|
||||||
|
intentionally broad: this feeds preview() only, the two backends expose differently-
|
||||||
|
shaped jars, and a cookie read must never crash a request — so any jar that doesn't
|
||||||
|
iterate cleanly degrades to {} rather than raising.
|
||||||
|
"""
|
||||||
jar = getattr(session, "cookies", None)
|
jar = getattr(session, "cookies", None)
|
||||||
if not jar:
|
if not jar:
|
||||||
return {}
|
return {}
|
||||||
@ -111,7 +116,12 @@ class CurlCffi:
|
|||||||
response = await session.request(method, url, impersonate=impersonate, **kwargs)
|
response = await session.request(method, url, impersonate=impersonate, **kwargs)
|
||||||
except aiohttp.ClientError:
|
except aiohttp.ClientError:
|
||||||
raise
|
raise
|
||||||
except Exception as error:
|
except asyncio.TimeoutError:
|
||||||
|
raise
|
||||||
|
except OSError as error:
|
||||||
|
# curl_cffi's RequestException subclasses OSError; translate the native
|
||||||
|
# network error into aiohttp.ClientError. narrowed from a bare Exception so a
|
||||||
|
# real bug (AttributeError/TypeError) isn't laundered into 'client error'
|
||||||
raise _as_client_error(error, "curl_cffi") from error
|
raise _as_client_error(error, "curl_cffi") from error
|
||||||
content = response.content if response.content is not None else b""
|
content = response.content if response.content is not None else b""
|
||||||
return Response(
|
return Response(
|
||||||
@ -230,7 +240,11 @@ class Noble:
|
|||||||
response = await session.execute_request(method=method.upper(), url=url, **kwargs)
|
response = await session.execute_request(method=method.upper(), url=url, **kwargs)
|
||||||
except aiohttp.ClientError:
|
except aiohttp.ClientError:
|
||||||
raise
|
raise
|
||||||
except Exception as error:
|
except asyncio.TimeoutError:
|
||||||
|
raise
|
||||||
|
except OSError as error:
|
||||||
|
# noble_tls's TLSClientException subclasses IOError (== OSError); translate
|
||||||
|
# the native network error, narrowed from bare Exception so a real bug surfaces
|
||||||
raise _as_client_error(error, "noble_tls") from error
|
raise _as_client_error(error, "noble_tls") from error
|
||||||
content = getattr(response, "content", None)
|
content = getattr(response, "content", None)
|
||||||
if content is None:
|
if content is None:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user