Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
refactor: log pending request content
NTFSvolume2b18d872e978
diff --git a/cyberdrop_dl/clients/http.py b/cyberdrop_dl/clients/http.pyindex 6bc618e01..c241118ba 100644--- a/cyberdrop_dl/clients/http.py+++ b/cyberdrop_dl/clients/http.py@@ -52,6 +52,9 @@ class _LazyResponseLog:resp["content"] = truncated_preview(resp["content"])return resp+ def content(self) -> dict[str, Any]:+ return {"content": self.__json__()["content"]}+def __str__(self) -> str:return str(self.__json__())@@ -256,6 +259,13 @@ class HTTPClient:finally:if self.request_done_callback:self.request_done_callback(request.url, resp, exc)+ if resp.has_content_not_logged:+ logger.debug(+ "Content from %s request [id=%s]\n%s",+ request.method,+ request.id,+ _LazyResponseLog(resp).content(),+ )del excdel respdiff --git a/cyberdrop_dl/clients/response.py b/cyberdrop_dl/clients/response.pyindex c8d345cb8..08a44560c 100644--- a/cyberdrop_dl/clients/response.py+++ b/cyberdrop_dl/clients/response.py@@ -73,6 +73,7 @@ class AbstractResponse(ABC, Generic[_ResponseT]):_text: str = EMPTY_CONTENT_cache: dict[str, Any] = dataclasses.field(init=False, compare=False, default_factory=dict)_lock: asyncio.Lock = dataclasses.field(init=False, compare=False, default_factory=asyncio.Lock)+ _fully_serialized: bool = Falsecreated_at: datetime.datetime = dataclasses.field(init=False,compare=False,@@ -95,6 +96,11 @@ class AbstractResponse(ABC, Generic[_ResponseT]):return self._text+ @final+ @property+ def has_content_not_logged(self) -> bool:+ return not self._fully_serialized and self._text is not EMPTY_CONTENT+def __json__(self) -> dict[str, Any]:try:content = self._get_content()@@ -103,7 +109,9 @@ class AbstractResponse(ABC, Generic[_ResponseT]):content = "<ERROR DECODING CONTENT>"if content is EMPTY_CONTENT:- content = "<DID NOT AWAIT FOR CONTENT>"+ content = "<DID NOT AWAIT FOR CONTENT YET>"+ else:+ self._fully_serialized = Truereturn {"url": str(self.url),