import requests from bs4 import BeautifulSoup url = "https://example.com" req = requests.get(url) # (url, headers) if you want soup = BeautifulSoup(req.content, 'html.parser') print(soup.prettify())