-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.py
35 lines (29 loc) · 949 Bytes
/
client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Library imports
import grpc
import logging
# Local imports
from matches_pb2 import CareerHistoryRating
from matches_pb2 import CareerMatchesRequest
from matches_pb2 import ScaleScore
import matches_pb2_grpc
# Logging config
logging.basicConfig(level='DEBUG')
logger = logging.getLogger(__name__)
channel = grpc.insecure_channel('localhost:50051')
stub = matches_pb2_grpc.CareerMatchesServiceStub(channel)
# Make a request...
logging.debug('Making a request...')
request = CareerMatchesRequest(
scale_scores=[
ScaleScore(scale_id=1, score=1.0),
ScaleScore(scale_id=2, score=1.0),
ScaleScore(scale_id=3, score=1.0),
],
career_history_ratings=[
CareerHistoryRating(career_id=1, rating=5.0),
CareerHistoryRating(career_id=2, rating=5.0),
CareerHistoryRating(career_id=3, rating=5.0),
]
)
matches = stub.GetMatches(request)
logging.debug('Request completed with %s' % str(matches))