Python Microservices: Build and Test REST endpoints with Tornado

Microservices

Python Microservices: Build and Test REST Endpoints With Tornado

Distilled lessons from building microservices powering Slang Labs platform. Presented in a PyCon India 2019 tutorial.

Satish Chandra Gupta
Published in
12 min readMar 14, 2020

--

At Slang Labs, we are building a platform for programmers to easily and quickly add multilingual, multimodal Voice Augmented eXperiences (VAX) to their mobile and web apps. Think of an assistant like Alexa or Siri, but running inside your app and tailored for your app.

The platform is powered by a collection of microservices. For implementing these services, we chose Tornado because it has AsyncIO APIs. It is not heavyweight. Yet, it is mature and has a number of configurations, hooks, and a nice testing framework.

This blog post covers some of the best practices we learned while building these services; how to:

  • Design REST endpoints as a separate layer over business logic,
  • Implement Tornado HTTP server and service endpoint handlers,
  • Use Tornado hooks to control behavior and assist debugging, and
  • Write unit and integration tests using Tornado testing infra.

Application REST Endpoints

--

--

Satish Chandra Gupta
The Startup

Cofounder @SlangLabs. Ex Amazon, Microsoft Research. I learn, do, and write about Machine Learning in production. https://www.ML4Devs.com