Log response headers for debugging

This commit is contained in:
JustAnotherArchivist
2023-01-16 03:48:21 +00:00
parent 49270f6d3a
commit 36e85c54c1

View File

@@ -219,9 +219,11 @@ class Scraper:
else: else:
redirected = f' (redirected to {r.url})' if r.history else '' redirected = f' (redirected to {r.url})' if r.history else ''
logger.info(f'Retrieved {req.url}{redirected}: {r.status_code}') logger.info(f'Retrieved {req.url}{redirected}: {r.status_code}')
logger.debug(f'... with response headers: {r.headers!r}')
if r.history: if r.history:
for i, redirect in enumerate(r.history): for i, redirect in enumerate(r.history):
logger.debug(f'... request {i}: {redirect.request.url}: {redirect.status_code} (Location: {redirect.headers.get("Location")})') logger.debug(f'... request {i}: {redirect.request.url}: {redirect.status_code} (Location: {redirect.headers.get("Location")})')
logger.debug(f'... ... with response headers: {redirect.headers!r}')
if responseOkCallback is not None: if responseOkCallback is not None:
success, msg = responseOkCallback(r) success, msg = responseOkCallback(r)
errors.append(msg) errors.append(msg)