In order to get the HTML of the website, we need to make a request to get the content of the webpage. To learn more about requests in a general sense, you can check out this article.
Python has a
requests library that makes getting content really easy. All we have to do is import the library, and then feed in the URL we want to
import requests webpage = requests.get('https://www.codecademy.com/articles/http-requests') print(webpage.text)
This code will print out the HTML of the page.
We don’t want to unleash a bunch of requests on any one website in this lesson, so for the rest of this lesson we will be scraping a local HTML file and pretending it’s an HTML file hosted online.
Make a GET request to the URL containing the turtle adoption website:
Store the result of your request in a variable called
Store the content of the response in a variable called
webpage by using
webpage out to see the content of this HTML.