mirror of
https://github.com/dmunozv04/iSponsorBlockTV.git
synced 2026-01-27 04:40:51 +03:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
class AiohttpTracer:
|
class AiohttpTracer:
|
||||||
def __init__(self, logger):
|
def __init__(self, logger):
|
||||||
self.logger = logger
|
self.logger = logger
|
||||||
@@ -17,9 +15,11 @@ class AiohttpTracer:
|
|||||||
chunk_size = len(params.chunk)
|
chunk_size = len(params.chunk)
|
||||||
try:
|
try:
|
||||||
# Try to decode as text
|
# Try to decode as text
|
||||||
text = params.chunk.decode('utf-8')
|
text = params.chunk.decode("utf-8")
|
||||||
self.logger.debug(f"Response chunk ({id(context):#x}) {chunk_size} bytes: {text}")
|
self.logger.debug(f"Response chunk ({id(context):#x}) {chunk_size} bytes: {text}")
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
# If not valid UTF-8, show as hex
|
# If not valid UTF-8, show as hex
|
||||||
hex_data = params.chunk.hex()
|
hex_data = params.chunk.hex()
|
||||||
self.logger.debug(f"Response chunk ({id(context):#x}) ({chunk_size} bytes) [HEX]: {hex_data}")
|
self.logger.debug(
|
||||||
|
f"Response chunk ({id(context):#x}) ({chunk_size} bytes) [HEX]: {hex_data}"
|
||||||
|
)
|
||||||
|
|||||||
@@ -160,9 +160,9 @@ async def main_async(config, debug, http_tracing):
|
|||||||
devices = [] # Save the devices to close them later
|
devices = [] # Save the devices to close them later
|
||||||
if debug:
|
if debug:
|
||||||
loop.set_debug(True)
|
loop.set_debug(True)
|
||||||
|
|
||||||
tcp_connector = aiohttp.TCPConnector(ttl_dns_cache=300)
|
tcp_connector = aiohttp.TCPConnector(ttl_dns_cache=300)
|
||||||
|
|
||||||
# Configure session with tracing if enabled
|
# Configure session with tracing if enabled
|
||||||
if http_tracing:
|
if http_tracing:
|
||||||
root_logger = logging.getLogger("aiohttp_trace")
|
root_logger = logging.getLogger("aiohttp_trace")
|
||||||
@@ -175,7 +175,7 @@ async def main_async(config, debug, http_tracing):
|
|||||||
web_session = aiohttp.ClientSession(connector=tcp_connector, trace_configs=[trace_config])
|
web_session = aiohttp.ClientSession(connector=tcp_connector, trace_configs=[trace_config])
|
||||||
else:
|
else:
|
||||||
web_session = aiohttp.ClientSession(connector=tcp_connector)
|
web_session = aiohttp.ClientSession(connector=tcp_connector)
|
||||||
|
|
||||||
api_helper = api_helpers.ApiHelper(config, web_session)
|
api_helper = api_helpers.ApiHelper(config, web_session)
|
||||||
for i in config.devices:
|
for i in config.devices:
|
||||||
device = DeviceListener(api_helper, config, i, debug, web_session)
|
device = DeviceListener(api_helper, config, i, debug, web_session)
|
||||||
|
|||||||
Reference in New Issue
Block a user