From the course: Using Python for Automation
Unlock this course with a free trial
Join today to access over 22,400 courses taught by industry experts.
Creating a request and parsing - Python Tutorial
From the course: Using Python for Automation
Creating a request and parsing
- [Instructor] I'm here on a website called, "Quotes to Scrape" and let's say we want to compile all the quotes, their authors, and the tags associated with each quote from this page. Let's start by taking a look at how the website is structured. I'm going to open up the Chrome Inspector tool, and this displays an HTML document that creates the webpage. To do this, go ahead and right click, and click Inspect. All websites have this component, which makes our job of scraping specific data a lot easier. This HTML document holds every piece of information that is visible on our page. Meaning our quotes are hidden somewhere in this jumble of HTML, we just got to find 'em. So in order to get this information to our python script, we'll need to create a get query. So to do that, I'll first copy the website's address and save it as a variable. Next, let's import the libraries that we'll be using. The request library houses the get function, and which we'll be using…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.