August 2018
Intermediate to advanced
248 pages
5h 51m
English
For our first example, you also need to install the Faker module, if it was not yet done, using the pip install faker command.
Then, we will use a file called service_first.py to contain all our code. We will see in a moment how it is going to be used.
Since the service will be called using the RPC protocol, we import the rpc function that will be used as a decorator to add this capability to the service definition. We also import the Faker class.
Our current service module file starts with these imports:
from nameko.rpc import rpcfrom faker import Faker
In Nameko, a service is a simple class with methods decorated with @rpc for the jobs the service offer. So, our PeopleListService class would look like this (well, just the ...