Demonstrating the URL Shortener
To learn more about writing asynchronous code and handling concurrency, check out:
To brush up on the knowledge that you’ll use in this project, check out:
- Object-Oriented Programming (OOP) in Python 3
- Working With JSON Data in Python
- Python Type Checking (Guide)
- Python’s Requests Library (Guide)
If you’d like to try out the REPL that the instructor is using, then check out bpython and the Real Python tutorial Discover bpython: A Python REPL With IDE-Like Features.
00:00 Python URL Shortener Demo. In this course, you’ll build an API to create and manage shortened URLs. The main purpose of this API is to receive a full target URL and return a shortened URL. To try out your API endpoint, you’ll leverage the documentation that FastAPI automatically creates.
00:25 When you post a target URL to the URL shortener app, you get a shortened URL and a secret key back.
00:48 The shortened URL contains a random key that forwards to the target URL.
00:56 You can use the secret key to see the shortened URL’s statistics …
01:06 or delete the forwarding.
01:31 Your URL shortener will provide API endpoints that are capable of receiving different HTTP request types. Each endpoint will perform an action that you’ll specify. On-screen, you can see a summary of the URL shortener’s API endpoints.
01:49 The code you are writing in this course focuses on getting the app working first. However, having a working app doesn’t always mean that the code behind it is perfect.
01:59 That’s why one of the sections in this course will refactor parts of the app. Note that your main goal in this course is to showcase the basics of FastAPI to quickly set up REST API server without going into more advanced topics like asyncio in Python, or thinking about performance.
02:18 If you want to learn more about writing asynchronous code, then check out this Real Python course. And if you’re looking for specifics on how FastAPI handles concurrency, then you can check out the FastAPI documentation.
02:34 Remember that the full source code for this project is available as part of the course materials. To get the most out of this course, you should be comfortable with the following concepts: object-oriented programming in Python 3, working with JSON data, Python type checking, and handling HTTP requests. In this course, you’ll build your app step by step, so even if you’re not familiar with the concepts listed here, then you’ll be able to follow along.
03:07 This course was created using the software versions listed on-screen.
03:14
Any code that’s seen in this course in the Python REPL will be run using the Bpython Interpreter, which offers a number of improvements over the standard Python REPL, including color coding. However, all of the code that you see running will work in the standard Python interactive shell, which is accessed typically by typing python
from a terminal where your virtual environment has already been activated.
03:38 So now you’ve seen what’s going to be covered in detail, in the next section of the course, you’ll prepare your development environment.
Become a Member to join the conversation.