We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Get HTML

Let's start crawling real web pages! For these remaining steps, use https://learnwebscraping.dev/practice/ecommerce/. A single product page like https://learnwebscraping.dev/practice/ecommerce/products/ashenfang-longsword-fan-1001/ is a good place to start.

Assignment

def get_html(url):

For now, your function should:

requests.get(url, headers={"User-Agent": "BootCrawler/1.0"})

I'd argue that it's not necessary to create unit tests for a function like get_html. It's primarily just side effects (internet access), making it not a pure function like normalize_url and get_urls_from_html. Most of the "logic" in get_html is just a couple of standard library function calls: and there's not much reason to test the standard library.

Run and submit the CLI tests.

Notice that they're grabbing some HTML from the main page of Wikipedia.