Posts tagged

External Data

Working with APIs: Fetching Data from External Sources

Introduces web APIs and the HTTP protocol as a mechanism for programs to retrieve external data. Shows how to install and use Python's requests library to send GET requests, parse JSON responses into Python dictionaries, and post data with requests.post(). Covers status code checking, raise_for_status() for automatic error propagation, and passing API keys in headers for authenticated endpoints. Also explains rate limiting, how to space out requests with time.sleep(), and closes with a weather data exercise using the OpenWeatherMap API.