This commit is contained in:
Eden Kirin
2023-03-18 21:30:15 +01:00
commit ce3eff47ea
14 changed files with 312 additions and 0 deletions

33
src/funnel/main.py Normal file
View File

@ -0,0 +1,33 @@
import logging
import grpc
from stubs import serve_hours_pb2
from stubs import serve_hours_pb2_grpc
SERVE_HOURS_HOST = "localhost"
SERVE_HOURS_PORT = 50001
SERVE_MINUTES_HOST = "localhost"
SERVE_MINUTES_PORT = 50002
SERVE_SECONDS_HOST = "localhost"
SERVE_SECONDS_PORT = 50003
SERVE_MILLISECONDS_HOST = "localhost"
SERVE_MILLISECONDS_PORT = 50004
TIMEZONE = "Europe/Zagreb"
def get_hours() -> int:
with grpc.insecure_channel(f"{SERVE_HOURS_HOST}:{SERVE_HOURS_PORT}") as channel:
stub = serve_hours_pb2_grpc.ServeHoursStub(channel)
response = stub.GetHours(serve_hours_pb2.GetHoursRequest(timezone=TIMEZONE))
print("GetHours() response: " + response.message)
return response.hours
def run():
hours = get_hours()
print(">>>>>>>>>>>>> Hours:", hours)
if __name__ == "__main__":
logging.basicConfig()
run()