A software intermediary that allows two applications (your python code and a remote program that can access information) to communicate with each other
RECALL:
Beautiful Soup → a library used for web scraping purposes to pull the data out of HTML and XML files. Helps with parsing HTML and XML documents to extract data. Think about the previous libraries we have imported (ie numpy)
In module 4 we focused on data sets, but using web scraping and APIs can give real time data!
Real time data updates:
Weather Data
Stock Data
Travel Information (flight schedules, hotel availability, etc.)
Live sports updates
Environmental Engineering
Get live data on water contaminants and pH level to know about the soil
Aerospace Engineering
Assessing real time wind speed and direction to adjust wind turbines
Automotive Engineering
Traffic information for route optimization and navigation suggestions
Both are methods used to access and retrieve data from the web, but they differ in their approaches and purposes.
Additionally, they both are accessible to the public.
To understand the difference between API & Webscrapping further, click here.
Follow along with the edpuzzle answering its questions to complete the trinket below!
Making your own extraction
Here you should use the API in order to extract and plot new data about temperature, windspeed, and precipitation. Fill in the blanks where necessary.
Coding Assistance: Click this link if you need help solving this problem.
Task Description:
You are tasked with creating a Python program that scrapes real-time system conditions data from the ERCOT (Electric Reliability Council of Texas) website and extracts relevant information such as frequency.
Requirements:
Create a function scrape_ercot_data(url) that takes a URL as input, sends an HTTP request to the provided ERCOT website, and extracts real-time system conditions data.
Parse the HTML content of the page using BeautifulSoup.
Extract the frequency value displayed on the page. The frequency value is located within a <td> element with the class labelClassCenter. Print the frequency value along with the current timestamp (use datetime.now()).
Handle the case when the HTTP request is not successful (status code other than 200). Print an error message indicating the failure and include the status code.
You may choose to extract additional information if available. For example, you can extract and print all text within <td> elements.
Challenge Notes:
Use the provided URL: 'https://www.ercot.com/content/cdr/html/real_time_system_conditions.html'
Utilize the requests library for sending HTTP requests.
Use BeautifulSoup for HTML parsing.
Display the extracted frequency and timestamp information in a readable format.
Here is an example output:
Coding Assistance: Click this link if you need help solving this problem.