Skip to content

victorkryz/EX-Rates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

$\color{MidnightBlue}\textit{\textbf{EX-Rates}}$

Python gRPC

Small Python client/server app that communicates by gRPC protocol and provides currency exchange rates

Prerequisites:

  • Python 3.7 or higher
  • Install Requests library (pip install requests)
  • Install google protobuf (pip install protobuf)
  • Install gRPC Python scaffold (grpcio, grpcio-tools) as it described in gRPC tutorial.

Run app:

  • Run the server:

     python ex_rates_svc.py
    

    Service listens port 50051

  • Run the client providing currency code like USD, EUR, UAH, GBP, etc. as a command line parameter, and optionally ip address of host where ex_rates_svc.py is launched (by default: localhost:50051)

     python ex_rates_clnt.py --code USD
     python ex_rates_clnt.py --code EUR --host ex-rates-service-ip:port
    

    The client prints the rates of the specified currency against to others

Update/generate gRPC code:

For (re)generation of gRPC code integrated into application use grpc_tools.
Run it from the project's root directory:

python -m grpc_tools.protoc -I./protos --python_out=gen --pyi_out=gen --grpc_python_out=gen protos/ex-rates.proto

The generated code drops into gen subfolder

About

Simple client/server app gives an exchange rates (Python, gRPC)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages