tu também pode usar a biblioteca requests

import requests
from bs4 import BeautifulSoup

url = str(input("Digite a url: ")

html = requests.get(url)

soup = BeautifulSoup(html, "html5lib")

html_treated = soup.prettify()

print(html_treated)