Web API Development with Python: A Beginner’s Guide using Flask and FastAPI
- Length: 168 pages
- Edition: 1
- Language: English
- Publication Date: 2021-07-29
- ISBN-10: B09BJLKM6F
- Sales Rank: #0 (See Top 100 Books)
Completely updated for Flask 2.0.1 and FastAPI 0.65.2
This book is a hands-on project based guide to building APIs designed for beginners who have never built an API before or professionals who want a quick intro to FastAPI or Flask.
The book uses Python libraries such as Flask microframework that is used by the likes of Netflix, Airbnb, Uber, Instagram, etc. making its way up to modern framework like FastAPI, which is on par to any with NodeJS, and Go in terms of performance and quickly being adopted as the #1 API tools written in Python.
You will also learn efficient routing, type-hinting, data transfer, HTTP messages, form data handling, REST API design, and data validation techniques.
In this book you will learn
- Fundamentals of APIs
- Introduction to tools for API development
- Flask backend development using REST architecture
- Connect to Front-end designed using Jinja2 templates
- FastAPI backed / API design
- Asynchronous API development
Table of Contents Prerequisites 1. Internet 2. Accounts 3. Operating System 4. Python 5. Terminal 6. Text Editor / IDE 7. Git for Version Control 8. Docker for Desktop (Optional) 9. Jupyter Notebook Chapter 1: Introduction to Web APIs 1.1 What is API? 1.2 Types of APIs 1.3 What is a Web API? 1.4 Getting our hands dirty 1.5 Getting hands dirty programmatically 1.6 JavaScript Object Notation (JSON) 1.7 Why are APIs needed? 1.8 API Design Patterns Chapter 2: Python & Working with APIs 2.1 Programmatically accessing an API Chapter 3: Building APIs with Flask 3.1 Initialise the development environment 3.2 Understanding the Starter Kit 3.3 Initialising the starter kit 3.3 A minimal Flask API 3.3 Explanation 3.5 Running the API 3.6 Call the API Programmatically 3.7 JSONIFY the response Chapter 4: Building interactive APIs 4.1 Capturing request arguments 4.2 Explanation 4.3 Testing the API 4.4 Catching sneaky behaviour and errors 4.4 Handling incorrect API requests Chapter 5: Multi-argument interactive API 5.1 Capturing multiple arguments 5.2 Explanation 5.3 Testing the API 5.4 Reader Challenge Chapter 6. Google search as an API 6.1 An informal introduction to URL and Querystring 6.2 What can we do with this information? 6.3 Understanding the Starter Kit 6.4 Logic of the application 6.5 Rendering home page 6.6 Returning Search Results 6.7 Explanation 6.8 Student Challenge Chapter 7: Building a Dictionary API 7.1 Understanding the Starter Kit 7.2 Logic of the application 7.3 Handle incoming searches 7.4 Finding the definition of the word 7.5 Handling list of words 7.6 Testing the API 7.7 Student Challenge 7.8 Jupyter Notebook to test the API Chapter 8: Building a POST API 8.1 API to add Filters 8.2 Understanding the Starter Kit 8.3 Logic of the application 8.4 Implementing the Filter 8.5 Testing the API 8.6 Getting filtered image 8.7 Bonus Challenge #2 Chapter 9: Bonus Lesson: Deploying the API 9.1 Configuring the CD Pipeline 9.2 Testing the API 9.3 Pro Tip: Testing using Terminal 9.4 Bonus Challenge Chapter 10: Introducing FastAPI 10.1 Asynchronous Programming 10.2 Enter FastAPI 10.3 Understanding the Starter Kit 10.4 Saying Hello FastAPI Chapter 11: Dictionary using FastAPI 11.1 Understanding the Starter Kit 11.2 Implementing the usage instructions 11.3 Implementing the dictionary 11.4 Testing the API 11.5 : FastAPI OpenAPI Docs and Swagger UI 11.6 Handling a list of words 11.7 Testing The API Chapter 12: Image filters using FastAPI 12.1 Bonus: Deployment to Heroku Chapter 13: FastAPI async / await 13.1 Making the program asynchronous 13.2 Making the filter API asynchronous 13.3 Test Scenario 1 13.4 Test Scenario 2 13.5 Test scenario 3 13.6 Test Scenario 4 13.7 Conclusion 13.8 Bonus Challenge Chapter 14: Making a TODO API 14.1 API Specifications 14.2 Initialise the environment 14.3 Understanding the starter kit 14.4 Request Body and Data Validation 14.5 Data Model for TODO 14.6 Task manager 14.7 Building the API 14.8 Final API design 14.9 Testing the API 14.10 Where to from here? Au Revoir About the Author Acknowledgements
Donate to keep this site alive
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.