Artificial Intelligence (AI) · Intermediate level

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

  1. 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

  2. Lesson 2 Secrets and Configuration

    Keep API keys out of code and manage settings safely.

    API keyenvironment variable.env file and .gitignoreconfiguration

  3. 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.