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