Module 1
Python for
AI Automation
Complete Roadmap · Day-by-Day Schedule · Resources · Projects
Tailored for: Comfortable Python level · 1–2 hours/day · Real Estate | Finance | E-Commerce
3 ~35 7 3
Weeks Total Total Hours New Skills Final Projects
■ Module Overview
What you'll learn and why it matters
What You Already Know (Skip These)
Since you're comfortable with OOP and pandas/numpy, we skip Python basics entirely. This module focuses ONLY on
the gaps between your current level and what's needed to build real AI automation systems.
OOP & Classes ■ Already know — skip
pandas / numpy ■ Already know — skip
loops, functions ■ Already know — skip
File I/O basics ■ Already know — skip
What You'll Master in This Module
requests / httpx Calling any web API from Python — the backbone of automation
JSON handling Parsing and building API responses cleanly and reliably
python-dotenv Securing API keys — never expose secrets in code
asyncio Running multiple agents simultaneously for 10x speed
FastAPI Wrapping your automation as a deployable web service
Error handling Retries, timeouts, fallbacks — production-grade resilience
Scheduling Running automations on a timer without manual triggering
Why These Skills Matter
Every AI automation — whether it's a real estate chatbot, a finance report agent, or an e-commerce monitor — is
ultimately Python talking to APIs. Master these 7 skills and you can build ANY automation that exists. They are the
universal building blocks.
Module 1: Python for AI Automation · Page 2
Week 1 — APIs & Data Flow
Days 1–7 · ~10–12 hours total
This week you go from 'I know Python' to 'I can talk to any service on the internet.' APIs are the nervous system of every
AI automation. Master them first.
DAY-BY-DAY SCHEDULE
D1 REST APIs & HTTP
Learn GET/POST/PUT/DELETE · status codes · headers · Postman
D2 requests Library
Install requests · GET calls · handle JSON response · print data
D3 API Authentication
API keys · Bearer tokens · OAuth basics · store keys safely
D4 POST Requests & Payloads
Send data to APIs · JSON body · form data · real API practice
D5 python-dotenv
Create .env file · load secrets · .gitignore it · best practices
D6 Error Handling
try/except · status code checks · retries with backoff · timeouts
D7 Practice Day
Build: Property data fetcher using a free real estate / geo API
KEY CONCEPTS
requests Library — Core Patterns
The requests library lets you call any API in 2–3 lines. You'll use this in literally every AI project you build:
[Link](url) Fetch data — reading property listings, stock prices
[Link](url, json={}) Send data — submitting to AI APIs, creating records
[Link]() Parse JSON response into a Python dictionary
response.status_code Check if call succeeded (200) or failed (4xx/5xx)
headers={'Authorization':…} Pass API keys securely in every request
python-dotenv — Never Expose API Keys
One of the most important professional habits. Your .env file holds all secrets and is NEVER committed to GitHub:
.env file OPENAI_API_KEY=sk-abc123 (never share this file)
.gitignore Add .env here so Git never tracks it
load_dotenv() Loads .env values into environment at runtime
[Link]('KEY') Retrieves the secret value safely in your code
Week 1 Mini-Challenge
Module 1: Python for AI Automation · Page 3
By end of Day 7 you should be able to: write a Python script that calls a free API (e.g. OpenWeatherMap, REST Countries, or
any real estate data API), extracts specific fields from the JSON response, and prints a formatted summary. If you can do this
comfortably — Week 1 is complete. ■
Module 1: Python for AI Automation · Page 4
Week 2 — Async, FastAPI & JSON Mastery
Days 8–14 · ~10–12 hours total
This week separates hobbyists from professionals. Async programming makes your agents run 5–10x faster. FastAPI
lets you ship your automation as a real service clients can use.
DAY-BY-DAY SCHEDULE
D8 JSON Deep Dive
Nested JSON · loops over lists · .get() safely · write JSON to file
D9 httpx & Async Basics
Install httpx · async/await syntax · event loop concept
D10 Async API Calls
async def · await [Link]() · run multiple calls at once
D11 [Link]()
Call 5 APIs simultaneously · measure speed vs sequential
D12 FastAPI Basics
Install FastAPI · create first endpoint · run with uvicorn
D13 FastAPI + Pydantic
Request/response models · input validation · auto docs at /docs
D14 Practice Day
Build: Async price checker hitting 5 e-commerce APIs at once
KEY CONCEPTS
asyncio — Why It's a Game Changer
Without async: calling 10 APIs takes 10 seconds. With async: it takes 1 second. Your AI agents WILL need to do many
things at once:
async def function() Marks a function as asynchronous — can be paused/resumed
await something() Pauses here and lets other tasks run while waiting
[Link](*tasks) Run ALL tasks simultaneously — massive speed boost
[Link](main()) Entry point — starts the async event loop
[Link]() Async-compatible HTTP client — use instead of requests
FastAPI — Your Agent's Front Door
FastAPI turns your Python automation into a service that anything can call — n8n, websites, mobile apps, other agents:
@[Link]('/listings') Create an endpoint — your agent responds to HTTP calls
@[Link]('/analyze') Receive data, process it with AI, return result
BaseModel (Pydantic) Define exact shape of input/output — auto-validated
/docs endpoint FastAPI auto-generates interactive API documentation
uvicorn main:app Run your API server — ready to deploy in 1 command
Module 1: Python for AI Automation · Page 5
Week 2 Mini-Challenge
Build a FastAPI app with one POST endpoint that receives a city name, calls a weather API and a property price API
simultaneously using [Link](), and returns a combined JSON response. If it works — Week 2 is complete. ■
Module 1: Python for AI Automation · Page 6
Week 3 — File Handling, Scheduling & OpenAI API
Days 15–21 · ~10–12 hours total
The final week bridges everything into actual AI. You'll handle real business files (PDFs, Excel, CSVs), automate
recurring tasks, and make your first OpenAI API call — the moment your Python becomes genuinely intelligent.
DAY-BY-DAY SCHEDULE
D15 File Handling for AI
Read/write CSV, Excel (openpyxl), JSON files · pathlib
D16 PDF Processing
Extract text from PDFs with pdfplumber · parse invoices
D17 schedule Library
Run functions every hour/day/week · background tasks
D18 OpenAI API Setup
Get API key · pip install openai · first completion call
D19 OpenAI Chat Completions
Messages array · system/user roles · parse AI response
D20 Connecting It All
API call → AI analysis → save result → schedule to repeat
D21 Final Project Day
Build one of the 3 capstone projects below — full build
KEY CONCEPTS
File Processing Libraries
openpyxl Read and write Excel files — perfect for finance/real estate reports
pdfplumber Extract text and tables from PDFs — invoices, statements, contracts
[Link] Modern file path handling — works on Windows, Mac, Linux
csv module Built-in CSV reading/writing — property data, transaction records
json module Built-in JSON handling — API data, config files, agent memory
schedule Library — Automation on Autopilot
[Link]().day Run a task once every day at a set time
[Link]().hour Run every hour — live price monitoring
[Link]().monday Run every Monday — weekly report generation
schedule.run_pending() Place in while loop to keep scheduler alive
OpenAI API — First Contact with AI
[Link] The main call — send messages, receive AI response
system message Give AI its role: 'You are a real estate analyst'
Module 1: Python for AI Automation · Page 7
user message The actual question or data you want analyzed
[Link][0] Extract the AI's text reply from the response object
model='gpt-4o-mini' Start with mini — cheap, fast, surprisingly capable
Module 1: Python for AI Automation · Page 8
■ Courses & Resources
Curated — No Fluff. Only What You Need.
FREE COURSES & TUTORIALS
Harvard's free Python course. Even at your level,
■ CS50P — Python [Link]/python FREE
weeks 4–9 are gold for file I/O and APIs.
■■ Corey Schafer Best Python tutorials on YouTube. Watch his
[Link]/@coreyms FREE
YouTube requests, OOP, and decorators playlists.
Article-based deep dives. Search: 'requests
■ Real Python [Link] FREE
tutorial', 'asyncio', 'FastAPI'. All free.
■ FastAPI Official The official tutorial is genuinely excellent. Follow it
[Link]/tutorial FREE
Docs top to bottom — takes ~3 hours.
■■ TechWithTim Practical Python projects — API tutorials,
[Link]/@TechWithTim FREE
YouTube automation scripts, FastAPI builds.
Official examples for every API feature. Bookmark
■ OpenAI Cookbook [Link] FREE
this — you'll use it for months.
■■ Akamai Async The definitive guide to asyncio in Python. Read [Link]/async-io-pytho
FREE
Tutorial this once — understand async forever. n
■ Automate Boring Free book online. Chapters 12-18 cover files,
[Link] FREE
Stuff Excel, PDFs, scheduling — exactly Module 1.
PAID COURSES (WORTH IT)
■ Udemy: 100 Days Best overall Python course. Even at your level, the
[Link] — Angela Yu PAID
of Code API and web sections are excellent.
■ [Link]: Andrew Ng's free short course on using OpenAI
[Link] FREE
ChatGPT API API. Only 1 hour. Do this in Week 3.
■ Arjan Codes Advanced Python patterns — clean code, async,
[Link]/@ArjanCodes FREE
YouTube FastAPI architecture. Elevates your coding.
DOCUMENTATION TO BOOKMARK
requests docs [Link] — complete reference, examples for everything
httpx docs [Link] — async HTTP, all features documented clearly
FastAPI docs [Link] — best API docs you'll ever read, with examples
openai-python [Link]/openai/openai-python — official Python SDK + examples
pydantic docs [Link] — data validation, used everywhere in AI systems
schedule docs [Link] — simple, clear scheduling reference
Module 1: Python for AI Automation · Page 9
■ Final Projects
3 Projects — One Per Niche — Build on Day 21
These projects use EVERY skill from the 3 weeks. Each is designed to be genuinely useful — something you could show
to a real client today.
Real Estate Property Alert System ■■ Medium 3–4 hrs
01 ■ Real Estate
What It Does
A scheduled Python agent that monitors property listings via API, filters by criteria (price, location, bedrooms), uses
OpenAI to write a natural-language summary of each new property, and sends a formatted email digest every morning.
Skills Used
requests Fetch listings from Zillow / RapidAPI real estate endpoint
python-dotenv Store API keys for real estate API + OpenAI + email
OpenAI API Generate natural language property summaries automatically
schedule Run every morning at 8 AM without manual triggering
openpyxl Save all listings to Excel for client reference
smtplib Send formatted email digest to agent's inbox
Why It's Valuable
Real estate agents spend 2+ hours daily checking listing sites. This does it in 30 seconds. A local agent would pay
$200–$500/month for this. Build it → show them → get your first client.
Finance Expense Categorizer & Report ■■ Medium 3–4 hrs
02 ■ Finance
What It Does
A FastAPI service that accepts a CSV or PDF bank statement upload, uses OpenAI to automatically categorize every
transaction (food, rent, utilities, etc.), calculates monthly spending summaries, and returns a clean Excel report with
charts.
Skills Used
FastAPI POST /analyze endpoint accepts file upload from any client
pdfplumber Extract transaction rows from PDF bank statements
pandas Group and aggregate transactions by category
OpenAI API Categorize each transaction description intelligently
openpyxl Generate Excel report with formatted tables
pydantic Validate incoming request structure automatically
Why It's Valuable
Module 1: Python for AI Automation · Page 10
Accountants manually categorize hundreds of transactions per client. This does it in seconds. Show this to a local accounting
firm — they'll want it immediately. Charge $300 setup + $99/month per client.
E-Commerce Competitor Price Monitor ■■■ Hard 4–5 hrs
03 ■ E-Commerce
What It Does
An async Python agent that monitors competitor product prices across multiple e-commerce sites simultaneously, detects
price drops or increases, uses OpenAI to write recommended pricing actions, and sends a real-time WhatsApp/email
alert when a competitor changes price on a tracked product.
Skills Used
httpx + asyncio Monitor 10 competitor URLs simultaneously — fast
schedule Run checks every 30 minutes around the clock
OpenAI API Generate pricing recommendations based on market data
python-dotenv Store API keys for OpenAI + Twilio WhatsApp
requests (Twilio) Send WhatsApp alert when price change detected
openpyxl Log all price history to Excel for trend analysis
Why It's Valuable
Every e-commerce seller needs to know what competitors charge. This is async so it checks 10 sites in the same time as
checking 1. E-commerce businesses would pay $500–$2,000/month for a live competitor monitoring tool.
Module 1: Python for AI Automation · Page 11
Module 1 Completion Checklist
■ ■ Can call any REST API with requests and handle JSON response
■ ■ API keys are always stored in .env — never hardcoded
■ ■ Can run multiple async API calls simultaneously with [Link]()
■ ■ Have a working FastAPI endpoint deployed locally
■ ■ Can extract data from PDFs and write to Excel with Python
■ ■ Have a scheduled automation running on a timer
■ ■ Have made at least one OpenAI API call that returns useful output
■ ■ One of the 3 final projects is fully working and on GitHub
What's Next → Module 2: Prompt Engineering
Once you complete all 3 projects, you're ready for the next module
You now speak the language of the internet. Every API, every service, every AI model is accessible
to you. Module 2 teaches you to speak the language of AI itself.
Build fast. Ship ugly. Learn everything. ■
Module 1: Python for AI Automation · Page 12