image logging
This commit is contained in:
parent
2cbf94f1ce
commit
231f7878b2
@ -14,8 +14,6 @@ import aiohttp
|
||||
import aiohttp_socks
|
||||
import html.parser
|
||||
import stream_providers
|
||||
import tracemalloc
|
||||
tracemalloc.start()
|
||||
|
||||
logging.basicConfig(format='[%(filename)s:%(lineno)d] %(message)s', stream=sys.stdout, level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -203,21 +201,25 @@ class UpstreamHandler():
|
||||
resp_upstream_future = session.get(self.upstream)
|
||||
try:
|
||||
resp_embed = await resp_embed_future
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
resp_embed = None
|
||||
try:
|
||||
resp_upstream = await resp_upstream_future
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
resp_upstream = None
|
||||
text_embed_future = resp_embed.text()
|
||||
text_upstream_future = resp_upstream.text()
|
||||
try:
|
||||
text_embed = await text_embed_future
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
text_embed = None
|
||||
try:
|
||||
text_upstream = await text_upstream_future
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
text_upstream = None
|
||||
parser = MetaParser()
|
||||
parser.feed(text_upstream)
|
||||
@ -244,11 +246,13 @@ class UpstreamHandler():
|
||||
image_status_standard_future = session.head(standard_image)
|
||||
try:
|
||||
image_status_full = await image_status_full_future
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
image_status_full = None
|
||||
try:
|
||||
image_status_standard = await image_status_standard_future
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
image_status_standard = None
|
||||
if hasattr(image_status_full, "status") and (image_status_full.status < 400):
|
||||
data["og:image"] = full_image
|
||||
|
Loading…
Reference in New Issue
Block a user