How to do it

We proceed with the recipe as follows:

  1. The sample microservice is implemented in 10/01/hello_microservice.py.  This is a very simple service that can be passed a name for which the microservice replies Hello, <name>!.
  2. To run the microservice, we need to simply execute the following command from the terminal (while in the directory for the script):
$nameko run hello_microservice
  1. Nameko opens the Python file matching the specified microservices name and starts up the microservice. When starting, we will see a few lines of output:
starting services: hello_microserviceConnected to amqp://guest:**@127.0.0.1:5672//
  1. This states that Nameko has found our microservice, and that it has connected to an AMQP server (RabbitMQ) on port ...

Get Python Web Scraping Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.