Intermediate level · Module 1 of 6 · 15 guided hours
Python for AI Applications
Use the Python needed for AI applications: working with JSON and HTTP APIs, managing secrets and handling errors.
Learning objectives
- Work with JSON data and HTTP APIs in Python
- Keep API keys secret and manage configuration
- Handle errors, retries and logging in API programs
Topics
- Python refresher for AI scripts
- JSON and dictionaries
- HTTP requests and responses
- API keys and environment variables
- error handling and retries
- logging
Lessons
-
Lesson 1 JSON and HTTP APIs
Send requests to web APIs from Python and work with the JSON they return.
HTTP request and responsestatus codesJSONrequests library
-
Lesson 2 Secrets and Configuration
Keep API keys out of code and manage settings safely.
API keyenvironment variable.env file and .gitignoreconfiguration
-
Lesson 3 Errors, Retries and Logging
Make API programs robust to network problems and rate limits, and keep useful logs.
exceptionstimeoutsretry with backofflogging
Practical activity
Write a Python script that calls a public, key-free practice API, saves results to JSON and handles network failures gracefully.
Expected outcomes
- Reliable Python scripts that use APIs
- Safe handling of secrets
Assessment
Code review against a checklist: no secrets in code, errors handled, results saved correctly.
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.