Module 12: Python Database and APIs
Advanced 12 chapters
155. Introduction to Databases
Learn what a database is, why programs use one instead of plain files, and the key ideas of tables, rows, keys, SQL and transactions.
156. SQLite with Python
Use Python's built-in sqlite3 module to connect to a database, run SQL safely with parameters, fetch rows, and manage transactions.
157. CRUD Operations
Learn the four basic database actions, Create, Read, Update and Delete, and how to perform each one from Python with the built-in sqlite3 module.
158. Database Connections
Learn how a Python program opens, uses and closes a database connection with sqlite3, including file and in-memory databases, cursors, row factories and safe cleanup.
159. SQL Queries Using Python
Run SELECT queries from Python with sqlite3: filter with placeholders, sort, search, group, join tables and read rows safely.
160. Transactions
Learn how transactions keep data safe with commit, rollback, the with statement and savepoints, using sqlite3 and a bank-transfer example.
161. Introduction to APIs
Learn what an API is, why programs talk to each other through APIs, and how web APIs send and receive data in JSON format.
162. HTTP Basics
Understand how HTTP works: requests, responses, methods, status codes, headers and URLs, with small runnable examples using the standard library.
163. Requests Library
Learn to use the third party requests library to call web APIs: sending GET requests, reading the status code, text and JSON, passing parameters and headers, and handling errors.
164. GET and POST Requests
Learn the difference between GET and POST requests and how to send query parameters, form data and JSON bodies with the requests library, with examples you can run on your own computer.
165. JSON API Responses
Learn how web APIs send data as JSON, how to turn a JSON text into Python dictionaries and lists, and how to read nested fields safely.
166. API Error Handling
Learn how to deal with failing API calls: read status codes, catch timeouts and bad data, retry safely, and raise clear errors of your own.