Typically when deploying python API’s I go with Flask. Over the years I’ve tried out a few python web frameworks but continually find myself coming back to Flask. It’s hard not to like with it’s simple setup and great documentation. Plus there’s plenty of examples out there on the internet on how to deploy Flask and use it for a variety of scenarios.
It’s considered a micro framework, so it comes with the bare bones to make a web framework run but leaves you the flexibility to pick and choose the libraries to add on that make the most sense for your app. When developing REST API’s I like using marshmallow, webargs, and apispec.
I recently came across flask-apispec that bundles all these libraries together and bolts onto the Flask framework. It has now become my go to when developing in Flask. Instead of having to account for marshmallow, webargs, and apispec seperately it neatly integrates all three into Flask and creates a cleaner experience. Plus because of the integrations it makes creating an open api specification easier and handles creation of the swagger documentation for you.
Example
I’m a visual learner so it’s helpful for me to see an example while also reading about it so I created a simple API demonstrating my setup. This example is meant to run in linux and the API allows you to GET, POST, and DELETE VRFs within linux. Included in the repo is a Vagrant file that will allow you to run the app on your machine. Check out the repo for instructions on getting it up and running with vagrant.