Metadata-Version: 2.1
Name: flask-grpc
Version: 0.1.0
Summary: A grpc client for Flask.
License: BSD-3-Clause
Author: codeif
Author-email: me@codeif.com
Requires-Python: >=3.8,<4.0
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: Flask (>=1.0.0)
Requires-Dist: grpcio (>=1.0.0)
Requires-Dist: protobuf (>3.0.0)
Description-Content-Type: text/x-rst

flask-grpc
====================

A grpc client for Flask.

Usage
-------

init

.. code-block:: python

    channel_wrapper = ChannelWrapper(
        target="gaea-partner-python-grpc-dev-cuwmnyhgmq-uc.a.run.app:443",
        secure=True,
        credentials=grpc.ssl_channel_credentials(),
    )
    channel_wrapper.init_app(app)

    health_stub = StubWrapper(health_pb2_grpc.HealthStub, channel_wrapper)

views

.. code-block:: python

    @app.route("/grpc")
    def grpc_api():
        reply = health_stub.Check(health_pb2.HealthCheckRequest())
        return f"grpc response: {reply}"

