Sitemap

Python: advancing object-oriented programming and working with APIs through FastAPI

3 min readMay 3, 2025

--

This course consists of 47 activities with an estimated workload of 8 hours and was completed on April 30, 2025. Topics include the following:

  • Heritage
  • Polymorphism and abstract method
  • Virtual environments
  • Requests, JSON and files
  • FastAPI

This training includes an in-depth approach to the concepts of classes with inheritance and polymorphism, as well as explanations on the use of virtual environments and their importance in isolating dependencies and keeping the project increasingly efficient and secure, especially when working on multiple projects. In other words, besides creating a virtual environment, activating it, and installing packages, the significance of virtualized environments in isolating and managing project dependencies is explored, helping to avoid conflicts between different library versions.

Virtual environment.
Installed packages

The API (Application Programming Interface), an essential concept in back-end development using Python, is also covered, as described below:

  • Using the requests module in Python to make API requests, demonstrating how to retrieve data from external services and integrate them into programs;
  • Practicing the process of making requests to a restaurant API, using the requests module to obtain information about each establishment in JSON format;
  • Saving data received from the API into JSON files, allowing local storage of restaurant information for future use;
  • Demonstrating how to create custom JSON files, providing a practical understanding of how to structure and organize data in a readable and interoperable format.
Press enter or click to view image in full size
Example of a structured JSON file

=> See the Python code for the project up to this point, hosted on GitHub at this link.

Get Dalvolinda Silva’s stories in your inbox

Join Medium for free to get updates from this writer.

Through FastAPI, the concept of APIs and their role as a bridge between different systems — allowing communication and data sharing — are explored, as outlined below:

  • Installing the FastAPI library and setting up an environment to create an API using Python;
  • Creating an endpoint with FastAPI to provide resources related to restaurants, enabling users to access specific information about these establishments;
  • Adding an endpoint that accepts a query parameter to filter restaurants based on their names, offering a flexible way to search for specific information;
  • Using docstrings to automatically generate documentation in FastAPI, making it easier to understand available endpoints.
The “hello” endpoint
Press enter or click to view image in full size
All endpoints built using FastAPI
Press enter or click to view image in full size
Execution of an API query for the KFC restaurant
Press enter or click to view image in full size
Response from the API query for the KFC restaurant.
Press enter or click to view image in full size
Execution of an API query for an unspecified restaurant
Response of an API query for an unspecified restaurant

=> See the project’s Python code built with FastAPI, hosted on GitHub at this link.

[Here is the Certificate of Completion.]

--

--

Dalvolinda Silva
Dalvolinda Silva

Written by Dalvolinda Silva

Mainframe Analyst and Developer / Information Scientist