diff --git a/src/betterproto/grpc/grpclib_server.py b/src/betterproto/grpc/grpclib_server.py index 59bc7d4..8b0bbd5 100644 --- a/src/betterproto/grpc/grpclib_server.py +++ b/src/betterproto/grpc/grpclib_server.py @@ -1,5 +1,5 @@ from abc import ABC -from collections import AsyncIterable +from collections.abc import AsyncIterable from typing import Callable, Any, Dict import grpclib diff --git a/src/betterproto/plugin/models.py b/src/betterproto/plugin/models.py index 36fa3b7..46dc9fb 100644 --- a/src/betterproto/plugin/models.py +++ b/src/betterproto/plugin/models.py @@ -653,7 +653,9 @@ class ServiceMethodCompiler(ProtoContentBase): self.output_file.typing_imports.add("AsyncIterable") self.output_file.typing_imports.add("Iterable") self.output_file.typing_imports.add("Union") - if self.server_streaming: + + # Required by both client and server + if self.client_streaming or self.server_streaming: self.output_file.typing_imports.add("AsyncIterator") super().__post_init__() # check for unset fields