The reason will be displayed to describe this comment to others. Learn more.
As a user of the API I'd be disappointed if an URL is opened in regular mode when I explicitly asked to open it in incognito mode. I'd therefore prefer to raise an exception when incognito mode isn't available.
For use cases where incognito mode is preferred but optional the user can code this themselves, whereas you cannot build my preferred semantics on top of the current implementation.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
hugovk and arhadthedev reacted with thumbs up emoji
The reason will be displayed to describe this comment to others. Learn more.
The two API use cases are different: open_new_tab vs open_new is "just" a different look and feel. "open_incognito" has semantic differences in the browser state (such as not storing the page in long term history and separate cookie stores). Opening a page in a regular window when an incognito window was requested can result in unwanted side effects.
I wouldn't mind a keyword argument to enable a fallback to open_new, but it shouldn't be the default. Just like exists_ok defaults to false in os.makedirs. Something like def open_incognito(url, *, regular_ok=False).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
The reason will be displayed to describe this comment to others. Learn more.
I agree with @ronaldoussoren: if a user is asking to keep their private URL secret, we must not "leak" that to the open internet, which could have extremely serious consequences for some people. Let's raise an exception instead.
Regarding Opera: if the user asks for a regular tab and it opens in private tab, that's fine, nothing is leaked.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
The reason will be displayed to describe this comment to others. Learn more.
I have no preference on whether it should be an exception of a separate method or a permissive argument.
I can agree with others about the issue in general only because a user who is supposed to get the incognito mode most likely will be unaware of it. So we have a choice between "always show user a warning in advance" vs "let the application gracefully treat a failure by showing an absolutely relevant warning with instructions (or an error if the very fact of page visitation must not be leaked)". Personally, I prefer the second option.
The exact interface choice is out of my competence.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
All reactions
"""
return open(url, 3)
def _synthesize(browser, *, preferred=False):
"""Attempt to synthesize a controller based on existing controllers.
Expand DownExpand Up
@@ -154,6 +162,9 @@ def open_new(self, url):
def open_new_tab(self, url):
return self.open(url, 2)
def open_incognito(self, url):
return self.open(url, 3)
class GenericBrowser(BaseBrowser):
"""Class for all browsers started with a command
Expand DownExpand Up
@@ -218,6 +229,7 @@ class UnixBrowser(BaseBrowser):
The reason will be displayed to describe this comment to others. Learn more.
it is related to the cmdline interface when webbroser main() func is called.
they belong also to the newly added incognito method.
therefore it is not a new feature from my perspective.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
The reason will be displayed to describe this comment to others. Learn more.
We do appreciate your contribution here!
As the PR author, you are in the best place to address the review by removing the code added to support --browser.
That can be discussed in a separate issue. But if you don’t have the time, then someone else could complete the PR.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
The reason will be displayed to describe this comment to others. Learn more.
for me this is a migration topic. the experts do know better what to do here. myself i dont see here in the working loop since i dont have this detailed knowledge of what being best on master code baseline
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don’t understand «migration». There are clear requests to remove some code that was added, to keep this PR focused on one thing. If you don’t want to pursue it, then someone else will have to volunteer.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
All reactions
browser = a
elif o == "-l":
for nam in _get_supported_browsers():
print(nam)
sys.exit()
elif o == '-h' or o == '--help':
print(usage, file=sys.stderr)
sys.exit()
Expand All
@@ -612,7 +647,15 @@ def main():
sys.exit(1)
url = args[0]
open(url, new_win)
if browser:
try:
br = get(browser)
except:
print(f"browser {browser} not found", file=sys.stderr)
Add support for incognito / private browsing for :func:`webbrowser.open`.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.