Skip to content

artificialinc/grpc_requests

This branch is 106 commits behind grpc-requests/grpc_requests:master.

Folders and files

NameName
Last commit message
Last commit date
Nov 28, 2023
Dec 3, 2023
Sep 30, 2023
Dec 3, 2023
Jul 20, 2020
Nov 23, 2023
Nov 28, 2023
Nov 29, 2023
Sep 30, 2023
Nov 28, 2023
Jul 20, 2020
Sep 2, 2023

Repository files navigation

grpc_requests

PyPI PyPI - Python Version PyPI download month License Views

GRPC for Humans

Leverage reflection to interact with GRPC in a familiar manner for users of the requests library.

from grpc_requests import Client

client = Client.get_by_endpoint("localhost:50051")
assert client.service_names == ["helloworld.Greeter"]

request_data = {"name": "sinsky"} 
say_hello_response = client.request("helloworld.Greeter", "SayHello", request_data)
assert say_hello_response ==  {"message":"Hello sinsky!"}

Features

  • Create a client easily when connecting to servers implementing grpc reflection
  • Still support creating a client from stubs when reflection isn't available
  • All unary and stream methods supported
  • TLS and compression connections supported
  • AsyncIO API supported

Install

pip install grpc_requests

Usage

In short:

Instantiate a client using the URL of a GRPC server and any authentication credentials you may need. If the server utilizes SSL (and it probably does) make sure to toggle that flag.

from grpc_requests import Client

metadata = [("authorization", "bearer my.cool.jwt")]
client = Client.get_by_endpoint("cool.servers.arecool:443", ssl=True, metadata=metadata)

The examples page provides more thorough examples of usage scenarioes, and the unit tests are also a useful reference point.

Contributing

Contributions from the community are welcomed and greatly appreciated.

Before opening a PR, tests.sh can be used to ensure the contribution passes linting and unit test checks.

PRs should be targeted to merge with the develop branch. When opening a PR, please assign it to a maintainer for review. The maintainers will take it from there.

Questions, Comments, Issues?

For questions, please start a conversation on the discussions page!

For feature requests or bugs, please open an issue and assign it the appropriate tag.

Maintainers

About

python grpc reflaction client

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.8%
  • Shell 0.2%