August 2018
Intermediate to advanced
248 pages
5h 51m
English
In our second example, let's reuse the idea of a toy service that helps produce a list of people. But, now we want the first name, last name, and address of people. We will then have a second service that depends on the first one to call it in order to get a list of people and then save that list on disk. Because our Service B depends on the Service A, we will use the RpcProxy class provided by Nameko, as you will see in a minute. The data will be saved using csv.
So, as you may guess, we start our service_second.py code file with the following imports:
from nameko.rpc import rpc, RpcProxyfrom faker import Fakerimport csv
Then, we define the new version of the PeopleListService using the following code:
fake = Faker()class ...