sift_client.transport.grpc_transport
¶
Transport layer for gRPC communication.
This module provides a simple wrapper around sift_py/grpc/transport.py for making gRPC API calls. It just stores the channel and the stubs, without any additional functionality.
| CLASS | DESCRIPTION |
|---|---|
GrpcClient |
A simple wrapper around sift_py/grpc/transport.py for making gRPC API calls. |
GrpcConfig |
Configuration for gRPC API clients. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
logger |
|
GrpcClient
¶
GrpcClient(config: GrpcConfig)
A simple wrapper around sift_py/grpc/transport.py for making gRPC API calls.
This class just stores the channel and the stubs, without any additional functionality.
Initialize the gRPC client.
| PARAMETER | DESCRIPTION |
|---|---|
config
|
The gRPC client configuration.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
__aenter__ |
|
__aexit__ |
|
__enter__ |
|
__exit__ |
|
close |
Close sync and async channels and stop the default loop. |
close_sync |
Close the sync channel and all async channels. |
get_stub |
Get an async stub bound to the current event loop. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
default_loop |
Return the default event loop used for synchronous API operations.
TYPE:
|
default_loop
property
¶
default_loop: AbstractEventLoop
Return the default event loop used for synchronous API operations.
| RETURNS | DESCRIPTION |
|---|---|
AbstractEventLoop
|
The default asyncio event loop. |
GrpcConfig
¶
GrpcConfig(
url: str,
api_key: str,
use_ssl: bool = True,
cert_via_openssl: bool = False,
metadata: dict[str, str] | None = None,
)
Configuration for gRPC API clients.
Initialize the gRPC configuration.
| PARAMETER | DESCRIPTION |
|---|---|
url
|
The URI of the gRPC server.
TYPE:
|
api_key
|
The API key for authentication.
TYPE:
|
use_ssl
|
Whether to use SSL/TLS.
TYPE:
|
cert_via_openssl
|
Whether to use OpenSSL for SSL/TLS.
TYPE:
|
use_async
|
Whether to use async gRPC client.
|
metadata
|
Additional metadata to include in all requests. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
api_key |
|
cert_via_openssl |
|
metadata |
|
uri |
|
use_ssl |
|