gapic-generator-python
gapic-generator-python copied to clipboard
Simplify get_transport_class for asyncio clients
Environment details
https://github.com/googleapis/python-logging/blob/440add263d1aeaa9fdfaf5b81c6d6f5f424f9131/google/cloud/logging_v2/services/logging_service_v2/client.py#L69 https://github.com/googleapis/python-logging/blob/440add263d1aeaa9fdfaf5b81c6d6f5f424f9131/google/cloud/logging_v2/services/logging_service_v2/async_client.py#L131
As seen in the logging_v2 example of a GAPIC generated API client, the LoggingServiceV2AsyncClient asyncio async_client.py copies the get_transport_class from LoggingServiceV2Client. This means, even with an async client I have to pass in grpc_asyncio to get the asyncio Transport.
client = LoggingServiceV2AsyncClient()
client.get_transport_class() # returns LoggingServiceV2GrpcTransport
client.get_transport_class('grpc_asyncio') # returns LoggingServiceV2GrpcTransport
# Better
client.get_transport_class() # returns LoggingServiceV2GrpcAsyncIOTransport
get_transport_class in async clients should return the async transport by default