New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

grpc-invoke

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grpc-invoke

a grpc request tool like requests

0.0.13
PyPI
Maintainers
1

Grpc Invoke

This is a package for python grpc client like grpcurl.

As We know

grpc's work mode is generating client and server via proto file, But sometime we can't get the proto file.If you are facing the problem above, this tool may help you a lot.

Features

  • you can do requests without any proto object

  • you can request your grpc server like http

  • you can use dictionary as your request data

  • support stream

  • support asyncio

  • support tls

Getting Started

$ pip install grpc-invoke
from grpc_invoke.grpc_client import GrpcClient


with GrpcClient("localhost:50052", "Service", "method") as client:
    resp = client.invoke(data={"data": "hello"}, header={"auth": "fdfefsssdffdg"})
    print(resp)

Enjoy it!

Notice

You should enable your server reflection. what you have to do is:

server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
hello_pb2_grpc.add_HelloServicer_to_server(Greeter(), server)


# start
SERVICE_NAMES = (
    hello_pb2.DESCRIPTOR.services_by_name['Hello'].full_name,
    reflection.SERVICE_NAME,
)
# enable reflection
reflection.enable_server_reflection(SERVICE_NAMES, server)

# done

server.add_insecure_port('[::]:50052')
server.start()
server.wait_for_termination()
SERVICE_NAMES = (
    hello_pb2.DESCRIPTOR.services_by_name['Hello'].full_name,
    reflection.SERVICE_NAME,
)
reflection.enable_server_reflection(SERVICE_NAMES, server)

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts