fix(browsers): make flag concatenation type-safe
Better implementation of #157 that's accepted by pyright/mypy. Thanks to @rostchri . Co-Authored-By: Christian Rost <chr@baltic-online.de>
This commit is contained in:
@@ -419,7 +419,7 @@ class BaseSessionMixin:
|
|||||||
if not config.cdp_url:
|
if not config.cdp_url:
|
||||||
flags = self._browser_options["args"]
|
flags = self._browser_options["args"]
|
||||||
if config.extra_flags or extra_flags:
|
if config.extra_flags or extra_flags:
|
||||||
flags = list(set(flags + (config.extra_flags or extra_flags)))
|
flags = list(set(tuple(flags) + tuple(config.extra_flags or extra_flags or ())))
|
||||||
|
|
||||||
self._browser_options.update(
|
self._browser_options.update(
|
||||||
{
|
{
|
||||||
@@ -480,7 +480,7 @@ class StealthySessionMixin(BaseSessionMixin):
|
|||||||
config = cast(StealthConfig, self._config)
|
config = cast(StealthConfig, self._config)
|
||||||
flags: Tuple[str, ...] = tuple()
|
flags: Tuple[str, ...] = tuple()
|
||||||
if not config.cdp_url:
|
if not config.cdp_url:
|
||||||
flags = DEFAULT_ARGS + STEALTH_ARGS
|
flags = tuple(DEFAULT_ARGS) + tuple(STEALTH_ARGS)
|
||||||
|
|
||||||
if config.block_webrtc:
|
if config.block_webrtc:
|
||||||
flags += (
|
flags += (
|
||||||
|
|||||||
Reference in New Issue
Block a user