summaryrefslogtreecommitdiffstats
path: root/Lib/webbrowser.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-123494: Improve documentation for ``webbrowser`` return types (#123495)Aarni Koskela2024-09-011-0/+3
| | | Document the return value for ``webbrowser.open*()``.
* gh-108172: do not override OS preferred browser if it is a super-string of a ↵Oded Arbel2024-08-311-1/+1
| | | | | | | | | | | known browser (GH-113011) When checking if the registering browser is the "OS preferred browser", do not use a substring search - that makes no sense: one can have a preferred browser that looks like a super-string of a known browser, e.g. "firefox-nightly" vs "firefox". https://github.com/python/cpython/issues/108172 explains in more detail, and lays out a potential better future enhancement for this case of just using xdg-open. We'll go with this for now. --------- Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-118673: Remove shebang and executable bits from stdlib modules. (#119658)Jason R. Coombs2024-05-291-1/+0
| | | | | | | * gh-118673: Remove shebang and executable bits from stdlib modules. * Removed shebangs and exe bits on turtledemo scripts. The setting was inappropriate for '__main__' and inconsistent across the other modules. The scripts can still be executed directly by invoking with the desired interpreter.
* gh-68583: webbrowser: replace `getopt` with `argparse`, add long options ↵Hugo van Kemenade2024-04-131-41/+49
| | | | (#117047)
* gh-114099: Additions to standard library to support iOS (GH-117052)Russell Keith-Magee2024-03-281-0/+67
| | | | | Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Malcolm Smith <smith@chaquo.com> Co-authored-by: Ned Deily <nad@python.org>
* gh-85644: webbrowser: Use $XDG_CURRENT_DESKTOP to check desktop (GH-21731)Marco Trevisan2024-03-021-3/+9
| | | | | | | | Usage of $GNOME_DESKTOP_SESSION_ID env variable is deprecated since GNOME 3.30.0 [1], so should not be used, while the standard XDG_CURRENT_DESKTOP should be instead preferred. [1] https://gitlab.gnome.org/GNOME/gnome-session/-/commit/00e0e6226371d53f65
* gh-113543: Make sure that `MacOSXOSAScript` sends `webbrowser.open` audit ↵Nikita Sobolev2023-12-281-0/+1
| | | | event (#113544)
* gh-87277: Don't look for X11 browsers on macOS in webbrowser (#24480)Ronald Oussoren2023-12-211-1/+6
| | | | | | | | The installation of XQuartz on macOS will unconditionally set the $DISPLAY variable. The X11 server will be launched when a program tries to access the display. This results in launching the X11 server when using the webbrowser module, even though X11 browsers won't be used in practice.
* gh-105745: Fix open method of webbrowser.Konqueror (#105746)Nikita Sobolev2023-06-141-9/+0
|
* gh-105407: Remove unused imports (#105554)Victor Stinner2023-06-091-1/+0
|
* gh-105545: Remove deprecated `MacOSXOSAScript._name` (gh-105546)Nikita Sobolev2023-06-091-14/+0
|
* gh-104804: Remove webbrowser.MacOSX class, deprecated in Python 3.11 (#104816)Hugo van Kemenade2023-05-261-51/+1
| | | | | Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-44844: Enable detection of Microsoft Edge browser in webbrowser module ↵Steve Dower2023-04-041-0/+16
| | | | (GH-29908)
* gh-102871: Remove obsolete browsers from webbrowser (#102872)James De Bias2023-03-311-78/+13
|
* gh-101313: Add -h and --help arguments to the webbrowser module (gh-101374)Icelain2023-03-221-3/+7
|
* gh-102690: Use Edge as fallback in webbrowser instead of IE (#102691)Jamoo7212023-03-161-4/+8
|
* bpo-43137: Revert "webbrowser: Don't run gvfs-open on GNOME" (GH-30417)Simon McVittie2022-01-051-0/+4
| | | | | | | | gvfs-open was deprecated in 2015 and removed in 2018, but its replacement, gio(1), is not available in Ubuntu 16.04, which is apparently still supported by CPython upstream even though it is considered to be EOL by Ubuntu developers. Signed-off-by: Simon McVittie <smcv@debian.org>
* bpo-43424: Deprecate `webbrowser.MacOSXOSAScript._name` attribute (GH-30241)Nikita Sobolev2021-12-301-5/+19
|
* bpo-43137: webbrowser: Replace gvfs-open and gnome-open with "gio open" ↵Simon McVittie2021-11-251-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-29154) * [bpo-43137](): webbrowser: Prefer gio open over gvfs-open gvfs-open(1) was superseded by gio(1) in 2015, and removed from GNOME releases in 2018. Debian and its derivatives like Ubuntu currently still have a compatibility shim for gvfs-open, but we plan to remove it. webbrowser prefers xdg-settings and xdg-open over gvfs-open, so this will only have any practical effect on systems where the xdg-utils package is not installed. Note that we don't check for GNOME_DESKTOP_SESSION_ID before using gio. gio does the right thing on any desktop environment that follows freedesktop.org specifications, similar to xdg-settings, so it's unnecessary to guard in this way. GNOME_DESKTOP_SESSION_ID was deprecated in 2008 and removed from upstream gnome-session in 2018 (it's still present in Debian/Ubuntu for backward compatibility, but probably shouldn't be). The replacement way to detect a desktop environment is the XDG_CURRENT_DESKTOP environment variable, which is a colon-separated sequence where the first item is the current desktop environment and the second and subsequent items (if present) are other desktop environments that it resembles or is based on. Resolves: * [bpo-43137](): webbrowser: Never invoke gnome-open gnome-open was part of GNOME 2, which was superseded in around 2010 and is unmaintained. The replacement was gvfs-open, which was subsequently replaced by gio(1) (as used in the previous commit). * [bpo-43137](): webbrowser: Don't run gvfs-open on GNOME gvfs-open was deprecated in 2015 and removed in 2018. The replacement is gio(1) (as used in a previous commit). GNOME_DESKTOP_SESSION_ID was deprecated in 2008 and removed in 2018. The replacement is XDG_CURRENT_DESKTOP (as mentioned in a previous commit). --- To test this on a typical modern Linux system, it is necessary to disable the `xdg-settings` and `xdg-open` code paths, for example with this hack: <details><summary>Hack to disable use of xdg-settings and xdg-open</summary> ```diff diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py index 3244f206aa..8f6c09d1d2 100755 --- a/Lib/webbrowser.py +++ b/Lib/webbrowser.py @@ -459,7 +459,7 @@ def open(self, url, new=0, autoraise=True): def register_X_browsers(): # use xdg-open if around - if shutil.which("xdg-open"): + if 0 and shutil.which("xdg-open"): register("xdg-open", None, BackgroundBrowser("xdg-open")) # Opens an appropriate browser for the URL scheme according to @@ -549,7 +549,7 @@ def register_standard_browsers(): # Prefer X browsers if present if os.environ.get("DISPLAY") or os.environ.get("WAYLAND_DISPLAY"): try: - cmd = "xdg-settings get default-web-browser".split() + cmd = "false xdg-settings get default-web-browser".split() raw_result = subprocess.check_output(cmd, stderr=subprocess.DEVNULL) result = raw_result.decode().strip() except (FileNotFoundError, subprocess.CalledProcessError, PermissionError, NotADirectoryError) : ``` </details> I haven't attempted to assess which of the specific web browsers such as Galeon are still extant, and which ones disappeared years ago. They could almost certainly be cleaned up, but that's beyond the scope of this PR.
* bpo-42255: Deprecate webbrowser.MacOSX from Python 3.11 (GH-27837)Dong-hee Na2021-09-031-0/+3
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-44740: Lowercase "internet" and "web" where appropriate. (#27378)Mariusz Felisiak2021-07-261-1/+1
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-44059: Register the SerenityOS Browser in the webbrowser module (GH-25947)Linus Groh2021-05-061-0/+4
| | | Automerge-Triggered-By: GH:gpshead
* bpo-41754: Ignore NotADirectoryError in invocation of xdg-settings (GH-23075)Ronald Oussoren2020-11-081-1/+1
| | | | It is not clear why this can happen, but several users have mentioned getting this exception on macOS.
* bpo-41005: Fixed perrmission error (GH-20936)Krishna Chivukula2020-06-221-1/+1
| | | | | | * fixed issue 41005: webbrowser fails when xdg-settings cannot be executed Co-authored-by: KrishnaSai2020 <krishnasai.chivukula@gmal.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-41043: Escape literal part of the path for glob(). (GH-20994)Serhiy Storchaka2020-06-201-1/+1
|
* bpo-40767: Allow pure Wayland to get default XDG web browser (GH-20382)Jeremy Attali2020-06-031-1/+1
| | | | | | | Would be nice to backport to python 3.7+. I don't think it's worth the hassle to backport this all the way down to 3.10. But I'll let the maintainers decide. This is hard to test because the test setup already includes this [environment variable](https://github.com/python/cpython/blob/master/Lib/test/pythoninfo.py#L292) Let me know if something doesn't match the PR guidelines. This is my first PR in the python source code.
* bpo-40561: Add docstrings for webbrowser open functions (GH-19999)Brad Solomon2020-05-111-0/+16
| | | | Co-authored-by: Brad Solomon <brsolomon@deloitte.com> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* Fix typo from base to based (GH-18055)Michael Haas2020-01-191-1/+1
|
* bpo-37363: Add audit events for a range of modules (GH-14301)Steve Dower2019-06-241-2/+9
|
* bpo-35308: Fix regression where BROWSER env var is not respected. (GH-10693)Zhiming Wang2018-11-261-2/+2
| | | | | Regression introduced in e3ce695 and 25b804a, where the old parameter update_tryorder to _synthesize was first ignored, then given the opposite value in the attempt to fix bpo-31014.
* bpo-31014: Fix the webbrowser module. (GH-7267)Serhiy Storchaka2018-07-081-3/+3
| | | | | | | webbrowser._synthesize() called webbrowser.register() with outdated signature. Co-Authored-By: John Still <john@jmsdvl.com>
* bpo-34019: Fix wrong arguments for Opera Browser (#8047)Bumsik Kim2018-07-031-4/+3
| | | | | The Opera Browser was using a outdated command line invocation that resulted in an incorrect URL being opened in the browser when requested using the webbrowser module. * Correct the arguments passed to the Opera Browser when opening a new URL.
* bpo-29645: Speed up importing the webbrowser module. (#484)Serhiy Storchaka2017-03-081-79/+92
|
* bpo-29644: suppress subprocess output from webbrowser (#289)Nick Coghlan2017-02-251-1/+2
| | | | | | When checking for the default X web browser, xdg-settings may emit messages on stderr if some components (such as kreadconfig5) are unavailable. These messages aren't of interest to Python, so we just ignore them.
* bpo-24241: Improve preferred webbrowser handling (#85)David Steele2017-02-251-12/+25
| | | | | | | | | | | | | | | | | | - Add 'preferred' argument to webbrowser.register - Use xdg-settings to specify preferred X browser The first change replaces the existing undocumented tri-state 'try_order' parameter with the documented boolean keyword-only 'preferred' parameter. Setting it to True places the browser at the front of the list, preferring it as the return to a subsequent get() call. The second change adds a private `_os_preferred_browser` setting and then uses that to make the default browser reported by `xdg-settings` first in the try list when running under X (or another environment that sets the `DISPLAY` variable). This avoids the problem where the first entry in the tryorder queue otherwise defaults to xdg-open, which doesn't support the "new window" option.
* Issue #23262: The webbrowser module now supports Firefox 36+ and derivedSerhiy Storchaka2016-10-301-8/+20
| | | | browsers. Based on patch by Oleg Broytman.
* Issue #24452: Make webbrowser support Chrome on Mac OS X.Guido van Rossum2016-10-131-0/+1
|
* Issue #25005: Backout fix for #8232 because of use of unsafe ↵Steve Dower2015-09-051-111/+9
| | | | subprocess.call(shell=True)
* Issue #8232: Renamed WinFireFox to WinFirefoxSteve Dower2015-06-151-2/+2
|
* Issue #8232: webbrowser support incomplete on Windows. Patch by Brandon MilamSteve Dower2015-06-081-9/+111
|
* The webbrowser module now uses subprocess's start_new_session=True ratherGregory P. Smith2014-08-271-11/+4
| | | | than a potentially risky preexec_fn=os.setsid call.
* Issue #19936: Added executable bits or shebang lines to Python scripts whichSerhiy Storchaka2014-01-161-0/+0
|\ | | | | | | | | | | | | requires them. Disable executable bits and shebang lines in test and benchmark files in order to prevent using a random system python, and in source files of modules which don't provide command line interface. Fixed shebang lines in the unittestgui and checkpip scripts.
| * Issue #19936: Added executable bits or shebang lines to Python scripts whichSerhiy Storchaka2014-01-161-0/+0
| | | | | | | | | | | | | | requires them. Disable executable bits and shebang lines in test and benchmark files in order to prevent using a random system python, and in source files of modules which don't provide command line interface. Fixed shebang line to use python3 executable in the unittestgui script.
* | #19975: remove unused imports from webbrowser module.R David Murray2013-12-131-3/+0
| | | | | | | | Report and patch by Claudiu Popa.
* | - Issue #17536: Add to webbrowser's browser list: www-browser, x-www-browser,doko@ubuntu.com2013-03-241-0/+6
|\ \ | |/ | | | | iceweasel, iceape.
| * - Issue #17536: Add to webbrowser's browser list: www-browser, x-www-browser,doko@ubuntu.com2013-03-241-0/+6
| | | | | | | | iceweasel, iceape.
* | Issue #16996: webbrowser module now uses shutil.which() to find aSerhiy Storchaka2013-02-131-51/+20
| | | | | | | | web-browser on the executable search path.
* | Replace IOError with OSError (#16715)Andrew Svetlov2012-12-251-1/+1
| |
* | Issue #16719: Get rid of WindowsError. Use OSError insteadAndrew Svetlov2012-12-191-1/+1
| | | | | | | | Patch by Serhiy Storchaka.
* | Issue #16717: get rid of socket.error, replace with OSErrorAndrew Svetlov2012-12-181-1/+1
| |