From the course: Build Three Real-World Python Applications

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

How to retrieve webpage information

How to retrieve webpage information - Python Tutorial

From the course: Build Three Real-World Python Applications

How to retrieve webpage information

- [Instructor] Now that we have gathered the HTML code and saved it to our variable response, we can gather some basic information about the webpage. First, we can gather the webpage URL as a sanity check to make sure we pulled the correct webpage. You can check a scraped webpage's URL by typing the following code response.url. Remember that response is our variable name, so make sure to use this variable name where you wish to call it. If we run this, we can see we have an output of our url, www.wisdompetmed.com. This means that we successfully pulled the correct webpage. Next, we can gather the HTTP status code of the webpage. This http status code is a message the website service sends to the browser to indicate whether the request can be fulfilled or not. So in this Jupyter notebook cell here, we are going to type in response.status_code and run it. Our output should show as 200. We are going to take a moment to explain…

Contents