1. Learn
  2. /
  3. Courses
  4. /
  5. Designing Forecasting Pipelines for Production

Connected

Exercise

Making an API request

Forecasting systems start with a data pipeline that gathers new data from an API or other data source. In this exercise, you'll create the URL link and send a request to the EIA API to retrieve electricity data.

Note that working with the EIA API requires creating an API key; for this exercise, a demo API key has been set up for you.

The requests, os, and pandas packages, as pd, were imported for you.

Instructions

100 XP
  • Extract the API key from the environment variable, saving it as eia_api_key.
  • Create the full URL path by combining api_url_path and eia_api_key.
  • Make the request using the correct method and passing the full link.