13. APIs#
Learning goals — By the end of this chapter you will be able to:
Explain what an API is and how REST APIs communicate over HTTP
Use the
requestslibrary to make GET requests and inspect the responseParse JSON responses into Python dicts and lists
Pass query parameters to filter or configure API responses
Handle HTTP errors and exceptions gracefully
APIs let your code communicate with the world — web services, data sources, and cloud tools all expose REST APIs. This chapter builds the practical skills to query any REST API from Python.