In this example, we will be extracting content from http://godfreysfeed.com/dealersandlocations.php. This website contains dealer locations information, which is shown in the screenshot that follows:
import reimport requestsdef read_url(url):'''Handles URL Request and ResponseLoads the URL provided using requests and returns the text of page source''' pageSource = requests.get(url).text return pageSourceif __name__ == "__main__":
For this and the other examples in this section, we will be using the re and requests libraries in order to retrieve the page source, that is, pageSource. Here, we will be using the read_url() function to do so.
The page contains HTML <form> elements so that we can search for ...