diff --git a/docs/changelog/index.rst b/docs/changelog/index.rst index 0b438f5..806109e 100644 --- a/docs/changelog/index.rst +++ b/docs/changelog/index.rst @@ -1,6 +1,12 @@ Changelog ========= +next +~~~~ + + - deprecated ``end`` keyword-only argument in the + :py:meth:`grpclib.server.Stream.send_message` method on the server-side + 0.1.0 ~~~~~ diff --git a/grpclib/server.py b/grpclib/server.py index 1392eb0..0867382 100644 --- a/grpclib/server.py +++ b/grpclib/server.py @@ -45,10 +45,14 @@ class Stream(StreamIterator): ('content-type', CONTENT_TYPE)]) self._send_initial_metadata_done = True - async def send_message(self, message, *, end=False): - if end: - warnings.warn('"end" argument is deprecated, ' - 'use "send_trailing_metadata" explicitly') + async def send_message(self, message, **kwargs): + if 'end' in kwargs: + warnings.warn('"end" argument is deprecated, use ' + '"stream.send_trailing_metadata" explicitly', + stacklevel=2) + + end = kwargs.pop('end', False) + assert not kwargs, kwargs if not self._send_initial_metadata_done: await self.send_initial_metadata()