Getting Started with Python Web APIs
See what people build with Python web APIs and the projects you'll build in this course, then set up Python, VS Code and Git on your own Windows or Mac computer, make a virtual environment, and use Git to get exercise code and hand in your work. You'll finish with your first FastAPI app answering in the browser and its automatic docs page.
Updated
What Python Web APIs Can Do
- What You Can Build with Python Web APIs (Novice): A web API is the program on a server that apps ask for data, and this lesson shows what people build with Python web APIs, what a web framework does, why this course uses FastAPI, and the five APIs you'll build.
- How This Course Works (Novice): How Python Web APIs works on ask-codey.com, from reading a lesson and trying its Do It to exercises checked by pytest and handed in with Git, chapter checks, module assessments and the APIs you build.
Setting Up for Python
- Setup on Windows: Python, VS Code and Git (Novice): Install Python with the Python Install Manager, VS Code with its Python extension, and Git on Windows with winget, check them with py --version and python --version in VS Code's terminal, tell Git your name and email, and make a python-course folder.
- Setup on a Mac: Python, VS Code and Git (Novice): Install Homebrew, then Python, VS Code with its Python extension, Git and Git Credential Manager on a Mac, check Python with python3 --version in VS Code's terminal, see why the command is python3 on a Mac, tell Git your name and email, and make a python-course folder.
- Finding Your Way in the Terminal (Novice): The terminal is where you run Python programs, and four commands that work the same in PowerShell and zsh, pwd, ls, cd and mkdir, tell you which folder you're in, show what's there, move you to another folder and make a new one.
- Virtual Environments and pip (Apprentice): A virtual environment gives each Python project its own private set of packages, pip installs packages into it from PyPI, and a requirements.txt with exact versions lets any computer install the same set with one command.
Share Your Work with Git
- Get the Exercise Code with Git (Novice): Copy an exercise's repository from GitHub into your course folder with git clone, open the folder it makes in VS Code, and see with git status and git remote -v that your copy remembers where it came from.
- Hand In Your Work with Git (Novice): Hand in an exercise by making a public repository of your own on GitHub, pointing your clone at it with git remote set-url, saving your work with git add and git commit, sending it with git push, and submitting the repository's address.
Your First FastAPI App
- Your First FastAPI App (Apprentice): Make a project folder with a virtual environment, install FastAPI, write GET routes that return a dictionary and a list for FastAPI to send as JSON, run the app with fastapi dev, and try every route on its docs page at /docs.
Exercise: Bakery Specials API
- Exercise: Bakery Specials API (Apprentice): Finish Maple Street Bakery's FastAPI app with two GET routes, a welcome message at / and today's specials at /specials, try them on the docs page, let pytest's tests check both, and hand your work in with Git.