Working with Files and APIs in Python
Connect Python to the real world — JSON, CSV, REST APIs, error handling, and configuration. Build a complete data pipeline as your capstone.
View badge details
About This Course
Make Python practical by learning to interact with external data sources and services. You'll parse JSON and CSV files, consume REST APIs with the requests library, handle errors gracefully with try/except and logging, and manage application configuration with environment variables. The course culminates in a capstone project where you build a complete CLI data pipeline that fetches API data, transforms it with classes and comprehensions, and outputs CSV and JSON reports. Requires Python Data Structures and OOP or equivalent experience. This is Course 3 of 3 in the Python Beginner Track.
Course Curriculum
12 Lessons
JSON Reading and Writing Structured Data
json.loads/load/dumps/dump, navigating nested JSON, type mapping, JSONDecodeError, indent/default parameters
JSON - Lab Exercises
json.loads/load/dumps/dump, navigating nested JSON, JSON-Python type mapping, JSONDecodeError handling, indent/default parameters
CSV and Tabular Data
csv.reader, csv.DictReader, csv.writer, csv.DictWriter, headers/delimiters/encoding, streaming large files
CSV and Tabular Data - Lab Exercises
csv.reader, csv.DictReader, csv.writer, csv.DictWriter, handling headers/delimiters/encoding, streaming large files with generators
Error Handling and Exceptions
try/except/else/finally, catching specific exceptions, exception hierarchy, custom exceptions, logging module, EAFP vs LBYL
Error Handling - Lab Exercises
try/except/else/finally, catching specific exceptions, exception hierarchy, custom exceptions, logging module basics, EAFP vs LBYL
HTTP and REST APIs with requests
requests.get/post, status codes, JSON responses, query parameters, headers, auth, raise_for_status, timeouts, pagination
REST APIs - Lab Exercises
requests.get/post, response.status_code/json()/text, query parameters, headers and auth, raise_for_status(), timeouts, basic pagination
Environment Variables and Configuration
os.environ/os.getenv, python-dotenv, .env files, configuration hierarchy, secrets hygiene, structured config loading
Configuration - Lab Exercises
os.environ/os.getenv, python-dotenv and .env files, configuration hierarchy, secrets hygiene and .gitignore, structured config loading
Capstone Briefing - API Data Pipeline
Reviews all beginner track concepts, explains the capstone project requirements for building a complete data pipeline CLI
Capstone - API Data Pipeline
Capstone project combining all beginner track skills: config management, API consumption with pagination, data transformation with classes and comprehensions, error handling with logging, CSV and JSON output