Skip to content

Commit f588115

Browse files
committed
Update CHANGELOG.md and type browser config arg
1 parent 11c8b08 commit f588115

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Added
1515

16+
- Add support for Brave browser @H1steria
17+
1618
### Changed
1719

1820
### Removed

zendriver/core/browser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from .. import cdp
2323
from . import tab, util
2424
from ._contradict import ContraDict
25-
from .config import Config, PathLike, is_posix
25+
from .config import BrowserType, Config, PathLike, is_posix
2626
from .connection import Connection
2727

2828
logger = logging.getLogger(__name__)
@@ -73,7 +73,7 @@ async def create(
7373
headless: bool = False,
7474
user_agent: str | None = None,
7575
browser_executable_path: PathLike | None = None,
76-
browser: str = "auto",
76+
browser: BrowserType = "auto",
7777
browser_args: List[str] | None = None,
7878
sandbox: bool = True,
7979
lang: str | None = None,

zendriver/core/config.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import sys
77
import tempfile
88
import zipfile
9-
from typing import Any, List, Optional, Union
9+
from typing import Any, List, Literal, Optional, Union
1010

1111
__all__ = [
1212
"Config",
@@ -23,6 +23,8 @@
2323
PathLike = Union[str, pathlib.Path]
2424
AUTO = None
2525

26+
BrowserType = Literal["chrome", "brave", "auto"]
27+
2628

2729
class Config:
2830
"""
@@ -34,7 +36,7 @@ def __init__(
3436
user_data_dir: Optional[PathLike] = AUTO,
3537
headless: Optional[bool] = False,
3638
browser_executable_path: Optional[PathLike] = AUTO,
37-
browser: str = "auto",
39+
browser: BrowserType = "auto",
3840
browser_args: Optional[List[str]] = AUTO,
3941
sandbox: Optional[bool] = True,
4042
lang: Optional[str] = None,
@@ -75,7 +77,7 @@ def __init__(
7577
:type user_data_dir: PathLike
7678
:type headless: bool
7779
:type browser_executable_path: PathLike
78-
:type browser: str
80+
:type browser: BrowserType
7981
:type browser_args: list[str]
8082
:type sandbox: bool
8183
:type lang: str
@@ -306,7 +308,7 @@ def find_binary(candidates):
306308
return winner
307309

308310

309-
def find_executable(browser: str = "auto") -> PathLike:
311+
def find_executable(browser: BrowserType = "auto") -> PathLike:
310312
"""
311313
Finds the executable for the specified browser and returns its disk path.
312314
:param browser: The browser to find. Can be "chrome", "brave" or "auto".

zendriver/core/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
if typing.TYPE_CHECKING:
1818
from .browser import Browser, PathLike
1919
from .. import cdp
20-
from .config import Config
20+
from .config import BrowserType, Config
2121

2222
__registered__instances__: Set[Browser] = set()
2323

@@ -31,7 +31,7 @@ async def start(
3131
user_data_dir: Optional[PathLike] = None,
3232
headless: Optional[bool] = False,
3333
browser_executable_path: Optional[PathLike] = None,
34-
browser: str = "auto",
34+
browser: BrowserType = "auto",
3535
browser_args: Optional[List[str]] = None,
3636
sandbox: Optional[bool] = True,
3737
lang: Optional[str] = None,

0 commit comments

Comments
 (0)