Skip to main content

a grpc request tool like requests

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grpc-invoke-0.0.6.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grpc_invoke-0.0.6-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file grpc-invoke-0.0.6.tar.gz.

File metadata

  • Download URL: grpc-invoke-0.0.6.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.6.3 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for grpc-invoke-0.0.6.tar.gz
Algorithm Hash digest
SHA256 d6c7194fdba12c5b01a57ff23bbb8c4204b130ad4bdee807b637c3a0bd84e0a8
MD5 76112fbe4455edecbc6fc0ec41ddf8de
BLAKE2b-256 fd29a6c711f6045f1b13e7cddc1ec40d36d4bae26b53b979b873ef88deccec1f

See more details on using hashes here.

File details

Details for the file grpc_invoke-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: grpc_invoke-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.6.3 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for grpc_invoke-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 8944fbd17029e16a133aaf0b3f322e0d063a331e165c563aa4b5b19672c8e7df
MD5 3753437fbcfa969034ab7969acdbd643
BLAKE2b-256 062f708d6cd8577040bbe91a0729553fbee53e17b19e4a48a69ef50bc9b1dcb2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page