Book Image

Flask Blueprints

By : Joel Perras
Book Image

Flask Blueprints

By: Joel Perras

Overview of this book

Table of Contents (14 chapters)

Chapter 5. Shutterbug, the Photo Stream API

In this chapter, we will build a (primarily) JSON-based API that allows us to view a reverse chronologically ordered list of photos that have been added—this has become quite popular in recent years due to Instagram and similar photo sharing applications. For the sake of simplicity, we will forgo the usual social aspect that many of these applications are typically built around; however, you are encouraged to combine the knowledge of the previous chapters with the information in this chapter to build such an application.

Shutterbug, the minimal API-only application that we are about to embark on, will allow a user to upload a photograph of their choosing via an authenticated, JSON-based API.

Additionally, we will use one of the lesser-known features of Flask (Werkzeug, really) to create a custom middleware that will allow us to intercept inbound requests and modify the global application environment for very simple API versioning.