This repository has been archived by the owner on Apr 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now properly generating GRPC files for python3
- Loading branch information
Showing
13 changed files
with
822 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
.idea/ | ||
.vscode/ | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Lines starting with '#' are comments. | ||
# Each line is a file pattern followed by one or more owners. | ||
|
||
# These owners will be the default owners for everything in the repo. | ||
* @thrawn01 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import gubernator.pb.ratelimit_pb2 as pb | ||
import gubernator.pb.ratelimit_pb2_grpc as pb_grpc | ||
import grpc | ||
|
||
|
||
class Client(object): | ||
def __init__(self, endpoint='127.0.0.1:9090', timeout=None, | ||
username=None, password=None): | ||
channel = grpc.insecure_channel(endpoint) | ||
print(dir(pb)) | ||
self.stub = pb_grpc.RateLimitServiceStub(channel) | ||
|
||
def ping(self): | ||
print(self.stub.Ping(pb.HealthCheckRequest())) |
Empty file.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! | ||
import grpc | ||
|
||
import peers_pb2 as peers__pb2 | ||
|
||
|
||
class PeersServiceStub(object): | ||
# missing associated documentation comment in .proto file | ||
pass | ||
|
||
def __init__(self, channel): | ||
"""Constructor. | ||
Args: | ||
channel: A grpc.Channel. | ||
""" | ||
self.GetPeerRateLimits = channel.unary_unary( | ||
'/pb.gubernator.PeersService/GetPeerRateLimits', | ||
request_serializer=peers__pb2.PeerRateLimitRequest.SerializeToString, | ||
response_deserializer=peers__pb2.PeerRateLimitResponse.FromString, | ||
) | ||
|
||
|
||
class PeersServiceServicer(object): | ||
# missing associated documentation comment in .proto file | ||
pass | ||
|
||
def GetPeerRateLimits(self, request, context): | ||
"""Used by peers to relay batches of requests to an authoritative peer | ||
""" | ||
context.set_code(grpc.StatusCode.UNIMPLEMENTED) | ||
context.set_details('Method not implemented!') | ||
raise NotImplementedError('Method not implemented!') | ||
|
||
|
||
def add_PeersServiceServicer_to_server(servicer, server): | ||
rpc_method_handlers = { | ||
'GetPeerRateLimits': grpc.unary_unary_rpc_method_handler( | ||
servicer.GetPeerRateLimits, | ||
request_deserializer=peers__pb2.PeerRateLimitRequest.FromString, | ||
response_serializer=peers__pb2.PeerRateLimitResponse.SerializeToString, | ||
), | ||
} | ||
generic_handler = grpc.method_handlers_generic_handler( | ||
'pb.gubernator.PeersService', rpc_method_handlers) | ||
server.add_generic_rpc_handlers((generic_handler,)) |
Oops, something went wrong.