· intermediate
Working with APIs in Python
Talk to a service over HTTP and handle what comes back. Building URLs correctly, reading JSON safely, telling a retryable failure from a permanent one, and paging through results without holding them all.
Written in house, from the work rather than from a syllabus. Every example is one we would use ourselves, and every exercise is checked against the same engine that grades your answer.
What you’ll learn
- Build a URL with query parameters that survives spaces and symbols
- Read a JSON response without exploding on a missing key
- Tell a client error from a server error, and know which are worth retrying
- Back off between retries instead of hammering a struggling service
- Page through a large result set lazily with a generator
- Keep credentials out of the code and out of the URL
Before you start
- · Comfortable writing functions and handling exceptions
- · Familiar with dictionaries and lists