I can't seem to find how to open a url in a private window. I've tried with chatGPT and stackoverflow but it just doesn't work. It either doesn't do anything, gives me an error or opens it in a normal window. I think webbrowser will be the best way to do it but if you have a better idea, feel free to let me know. I will be very glad if you could help me!
#π I want to open a url in a private firefox window with the webbrowser module
42 messages Β· Page 1 of 1 (latest)
@sterile void
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Closes after a period of inactivity, or when you send !close.
if you know where the firefox install is
you could launch it yourself with firefox -private from the command line
if you are on a linux like system, you could use the whereis command
root~$ whereis firefox
firefox: /usr/bin/firefox /etc/firefox /snap/bin/firefox
But I want to do it with python to automate it
do you know where the firefox install is located?
Yes
do you just want to load one singular webpage?
I've tried to do it with the webbrowser module and it does it but it opens it in a normal browser even tho I add the '-private' or incognito or whatever
Yes, for proof of concept, and later I will add it in a for loop
I mean, if it's just one website
import os
URL = 'example.com'
os.system( "firefox -private '" + URL + "'" )
yeahh
here's what i have for now
also add https://
I have accidentally given you the wrong command line option
the correct option is
firefox -private-window $URL
replace $URL with your website
in quotes
root~$ firefox -private-window "https://www.youtube.com"
so it should become:
os.system(f"{firefox_path} -private '" + url + "'")
just follow this
it should be good
thanks
yeah
notify me if it works
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.