14 """The Python implementation of the gRPC route guide client."""
16 from __future__
import print_function
22 import route_guide_pb2
23 import route_guide_pb2_grpc
24 import route_guide_resources
34 feature = stub.GetFeature(point)
35 if not feature.location:
36 print(
"Server returned incomplete feature")
40 print(
"Feature called %s at %s" % (feature.name, feature.location))
42 print(
"Found no feature at %s" % feature.location)
55 print(
"Looking for features between 40, -75 and 42, -73")
57 features = stub.ListFeatures(rectangle)
59 for feature
in features:
60 print(
"Feature called %s at %s" % (feature.name, feature.location))
64 for _
in range(0, 10):
65 random_feature = feature_list[random.randint(0,
len(feature_list) - 1)]
66 print(
"Visiting point %s" % random_feature.location)
67 yield random_feature.location
74 route_summary = stub.RecordRoute(route_iterator)
75 print(
"Finished trip with %s points " % route_summary.point_count)
76 print(
"Passed %s features " % route_summary.feature_count)
77 print(
"Travelled %s meters " % route_summary.distance)
78 print(
"It took %s seconds " % route_summary.elapsed_time)
90 print(
"Sending %s at %s" % (msg.message, msg.location))
96 for response
in responses:
97 print(
"Received message %s at %s" %
98 (response.message, response.location))
107 print(
"-------------- GetFeature --------------")
109 print(
"-------------- ListFeatures --------------")
111 print(
"-------------- RecordRoute --------------")
113 print(
"-------------- RouteChat --------------")
117 if __name__ ==
'__main__':
118 logging.basicConfig()