Skip to content

Commit

Permalink
internal cleanup to chapter download code
Browse files Browse the repository at this point in the history
  • Loading branch information
AbstractUmbra committed Nov 24, 2021
1 parent 643d4e6 commit 76d7b64
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions hondana/chapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,26 +366,26 @@ async def _pages(
route = CustomRoute("GET", self._at_home_url, f"/{'data-saver' if data_saver else 'data'}/{self.hash}/{url}")
LOGGER.debug("Attempting to download: %s" % route.url)
_start = time.monotonic()
page_resp: tuple[bytes, ClientResponse] = await self._http.request(route)
response: tuple[bytes, ClientResponse] = await self._http.request(route)
data, page_resp = response
_end = time.monotonic()
_total = _end - _start
LOGGER.debug("Downloaded: %s" % route.url)

if report is True:
await self._http._at_home_report(
route.url,
page_resp[1].status == 200,
"X-Cache" in page_resp[1].headers,
(page_resp[1].content_length or 0),
page_resp.status == 200,
"X-Cache" in page_resp.headers,
(page_resp.content_length or 0),
int(_total * 1000),
)

if page_resp[1].status != 200:
if page_resp.status != 200:
self._at_home_url = None
break
else:
data = page_resp
yield data[0], url.rsplit(".")[-1]
yield data, url.rsplit(".")[-1]

else:
return
Expand Down

0 comments on commit 76d7b64

Please sign in to comment.