Skip to main content

grpc for Humans. grpc reflection support client

Project description

grpc_requests

PyPI - Python Version PyPI PyPI download month codecov Views

##GRPC for Humans

Feature

  • connect server using reflection
  • no need stub class request grpc
  • supprot method
    • unary-unary
    • unary-stream
    • stream-unary
    • stream-stream

install

pip install grpc_requests

example

from grpc_requests import Client

port = '50051'
host = "localhost"
endpoint = f"{host}:{port}"

client = Client.get_by_endpoint(endpoint)
print(client.service_names) # ["helloworld.Greeter"]

service = "helloworld.Greeter"
method = 'SayHello'

request_data = {"name": 'sinsky'} # You Don't Need Stub!
result = client.unary_unary(service, method, request_data)
print(type(result)) # result is dict Type!!! not Stub Object!
print(result) # {"message":"Hellow sinsky"}

using Stub example

from grpc_requests import Client
from helloworld_pb2 import HelloRequest

port = '50051'
host = "localhost"
endpoint = f"{host}:{port}"

client = Client.get_by_endpoint(endpoint)
print(client.service_names) # ["helloworld.Greeter"]

service = "helloworld.Greeter"
method = 'SayHello'

result = client.unary_unary(service, method, HelloRequest(name='sinsky'))
print(type(result)) # result is dict Type!!! not Stub Object!
print(result) # {"message":"Hellow sinsky"}

# or get raw response data
result = client.unary_unary(service, method, HelloRequest(name='sinsky'),raw_output=True)
print(type(result)) # HelloReply stub class

Relation Project

  • homi : micro grpc framework like flask. easy to use!

Change Logs

  • 0.0.1
    • sync proto using reflection
    • auto convert request(response) from(to) dict
    • support unary-unary

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_requests-0.0.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

grpc_requests-0.0.1-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file grpc_requests-0.0.1.tar.gz.

File metadata

  • Download URL: grpc_requests-0.0.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for grpc_requests-0.0.1.tar.gz
Algorithm Hash digest
SHA256 88958f02e49caa83624a6e608bcc06829901bc64087eb9aa94df63ca1e55ce48
MD5 5b9a09788fe6973356c38583b24d4cd2
BLAKE2b-256 3b187652325c343f92d6170c5834e17292669419640952f5d1184b204d03aa0d

See more details on using hashes here.

File details

Details for the file grpc_requests-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: grpc_requests-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for grpc_requests-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 84587fba79471533f612fcc15a7aabe6ebc4c4d38e6a96a551d108da73893a8a
MD5 6f74e2f44df1d2e88fc7cafb8cf48eb7
BLAKE2b-256 a2190b520d528b82e5a9b821a8e1e515d0193f91d5d01a4788f666972a63d3a9

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