Skip to content

Commit

Permalink
馃摝 Export Browser type (#16)
Browse files Browse the repository at this point in the history
* 馃摝 Export Browser type

* Bump version
  • Loading branch information
roniemartinez committed Apr 26, 2022
1 parent 943a4a0 commit f638432
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ and the known `webbrowser` standard library does not support arguments.
pip install pybrowsers
```

## Features

- Detect browser on OSX
- Detect browser on Linux
- Detect browser on Windows
- Launch browser with arguments
- Launch and get browser by version with wildcard support

## Usage

### Import
Expand Down Expand Up @@ -111,14 +119,6 @@ browsers.launch("chrome", version="100.0.4896.127") # complete version
browsers.launch("chrome", version="100.*") # wildcard
```

## TODO:

- [x] Detect browser on OSX
- [x] Detect browser on Linux
- [X] Detect browser on Windows
- [x] Launch browser with arguments
- [x] Get browser by version (support wildcards)

## References

- [httptoolkit/browser-launcher](https://github.com/httptoolkit/browser-launcher)
Expand Down
2 changes: 1 addition & 1 deletion browsers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from . import linux, osx, windows
from .common import Browser

__all__ = ["browsers", "get", "launch"]
__all__ = ["Browser", "browsers", "get", "launch"]

logging.basicConfig(stream=sys.stdout, level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")
logger = logging.getLogger(__name__)
Expand Down
4 changes: 2 additions & 2 deletions browsers/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ def _win32_browsers_from_registry(tree: int, access: int) -> Iterator[Browser]:
break
try:
display_name = winreg.QueryValue(hkey, subkey)
if not display_name or not isinstance(display_name, str):
if not display_name or not isinstance(display_name, str): # pragma: no cover
display_name = subkey
except OSError:
except OSError: # pragma: no cover
display_name = subkey
try:
cmd = winreg.QueryValue(hkey, rf"{subkey}\shell\open\command")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pybrowsers"
version = "0.4.0"
version = "0.4.1"
repository = "https://github.com/roniemartinez/browsers"
description = "Python library for detecting and launching browsers"
authors = ["Ronie Martinez <ronmarti18@gmail.com>"]
Expand Down

0 comments on commit f638432

Please sign in to comment.