Metadata-Version: 2.4
Name: alvenir_grpc_contracts
Version: 0.0.2
Summary: Generated gRPC python files for interacting with Alvenir Services
Project-URL: Homepage, https://github.com/alvenirai/alvenir-grpc-contracts
Project-URL: Issues, https://github.com/alvenirai/alvenir-grpc-contracts/issues
Author-email: Moesen <gustav@alvenir.ai>
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Requires-Dist: grpcio>=1.59.0
Requires-Dist: protobuf>=5.29.3
Provides-Extra: dev
Requires-Dist: grpcio-tools>=1.59.0; extra == 'dev'
Description-Content-Type: text/markdown

# Alvenir GRPC Contracts

This package provides methods for interacting with the alvenir gRPC api.

To see more about gRPC look here: https://grpc.io/

Package on pypi: https://pypi.org/project/alvenir-grpc-contracts/

## Installation
```py
pip install alvenir-grpc-contracts
```

## Usage example
```py
import grpc
from pathlib import Path
from alvenir_grpc_contracts.summary.v1 import summary_pb2_grpc
from alvenir_grpc_contracts.types.v1 import ping_pb2

# Endpoint needs to be provided by alvenir
ENDPOINT = "<grpc_endpoint>:443"
# Required if server uses tls
ROOT_CERT = Path("<path to alvenir ca.crt>").read_bytes()

# If server does not use tls, replace credentials and with statement with:
# with grpc.insecure_channel(ENDPOINT) as channel:
credentials = grpc.ssl_channel_credentials(root_certificates=ROOT_CERT)
with grpc.secure_channel(ENDPOINT, credentials=credentials) as channel:
    stub = summary_pb2_grpc.SummaryServiceStub(channel)
    response: ping_pb2.PingResponse = stub.Ping(
        ping_pb2.PingRequest(wait_time=1)
    )
    print(response.requests_received_utc, response.response_sent_utc)
```
