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 - 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
-
-
-
What is web scraping?2m 57s
-
Introducing the Wisdom Pet Medicine website2m 4s
-
How to explore a webpage2m 45s
-
(Locked)
Understanding HTML code1m 56s
-
(Locked)
Understanding the requests package3m 8s
-
(Locked)
How to use the get() method2m 38s
-
(Locked)
How to retrieve webpage information4m 4s
-
(Locked)
How to retrieve HTML code1m 36s
-
(Locked)
How to use BeautifulSoup2m 20s
-
(Locked)
How to use find() and find_all() methods3m 52s
-
(Locked)
How to loop find_all() methods3m 21s
-
(Locked)
How to retrieve webpage links2m 18s
-
(Locked)
How to write HTML code to a text file2m 7s
-
-
-
-