Is there anyway to open a URL in Python without opening a tab in a browser?
I have a preconstructed URL which I would like to run when the computer is idle e.g. http://foo.com/bar
I've been able to use the start
and webbrowser
methods but these open a new tab in my browser.
F.Y.I. The URL returns a blank page with nothing more than the word OK
which I don't need.
Could anyone suggest any other way like via a batch or any other program that could do this?
A Uniform Resource Locator (URL) is actually a web address to open a specific site. Sometimes while working in python we need to fetch data from a website, for this we have to open the url of a specific website. So, to open a URL in python we need to import the specified module and perform some steps to open that URL.
Use urllib (Python 2.x):
import urllib
urllib.urlopen('http://foo.com/bar')
(Python 3.x)
import urllib.request
urllib.request.urlopen('http://foo.com/bar')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With