Book Image

Building Serverless Python Web Services with Zappa

By : Abdulwahid Abdulhaque Barguzar
Book Image

Building Serverless Python Web Services with Zappa

By: Abdulwahid Abdulhaque Barguzar

Overview of this book

Serverless applications are becoming very popular these days, not just because they save developers the trouble of managing the servers, but also because they provide several other benefits such as cutting heavy costs and improving the overall performance of the application. This book will help you build serverless applications in a quick and efficient way. We begin with an introduction to AWS and the API gateway, the environment for serverless development, and Zappa. We then look at building, testing, and deploying apps in AWS with three different frameworks--Flask, Django, and Pyramid. Setting up a custom domain along with SSL certificates and configuring them with Zappa is also covered. A few advanced Zappa settings are also covered along with securing Zappa with AWS VPC. By the end of the book you will have mastered using three frameworks to build robust and cost-efficient serverless apps in Python.
Table of Contents (20 chapters)
Title Page
Dedication
Packt Upsell
Contributors
Preface
Index

Designing Falcon APIs


We are going to design a REST API based on a quote concept. A quote might be something a famous person said, or it might be a dialog from a movie. We are going to use Mashape's Random Famous Quotes API (https://market.mashape.com/andruxnet/random-famous-quotes). Mashape is an API platform and it provides many categories of APIs. 

In our case, we will create a single API with the following operations:

  • Generate or retrieve a quote for the day
  • Generate a random quote

For the first operation, we will need to store a random quote from the Mashape API into our database on a daily basis. Hence, we need to design a task scheduler to execute on a daily basis and to store the quote from the Mashape API into our database so that our API user can get the quote for the day.

For the second operation, we don't need to persist each and every randomly generated quote from the Mashape API. Instead, we return the generated random quote to our API user.

Scaffolding the application

When designing...