0

I use chrome Momentum extension to customize my browser new tab and would like to write a python script to get its daily dashboard wallpaper

By now I know I can reach desired page through the url

chrome-extension://laookkfknpbbblfpciffpaejjkokdgca/dashboard.html

However, when I try to call urllib.request.urlopen with this url the following error is raised:

urllib.error.URLError: <urlopen error unknown url type: chrome-extension>

Is possible to include custom protocols to be open by urllib?

Or would there be another way to get page html result?

artu-hnrq
  • 1,343
  • 1
  • 8
  • 30

1 Answers1

0

If the file exists locally and not on the web then using urllib won't do you much good since it's not a URL.

use webbrowser lib instead and provide a path to your file:


    def auto_open():
        """
        This method takes the absolute path to the html file and opens it directly in the browser.
        """
        html_page = 'path/to/your/file'
        # open in a new tab.
        new = 2
        webbrowser.open(html_page, new=new)