Skip to content

Commit

Permalink
Pass params also when subscribe (#223)
Browse files Browse the repository at this point in the history
* Pass params also when subscribe

* Add fragment.
  • Loading branch information
Christian Barra authored Apr 17, 2018
1 parent 6dab874 commit ff853b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES/223.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pass params to docker events.
4 changes: 2 additions & 2 deletions aiodocker/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ def listen(self):
DeprecationWarning, stacklevel=2)
return self.channel.subscribe()

def subscribe(self, *, create_task=True):
def subscribe(self, *, create_task=True, **params):
"""Subscribes to the Docker events channel. Use the keyword argument
create_task=False to prevent automatically spawning the background
tasks that listen to the events.
This function returns a ChannelSubscriber object.
"""
if create_task and not self.task:
self.task = asyncio.ensure_future(self.run())
self.task = asyncio.ensure_future(self.run(**params))
return self.channel.subscribe()

def _transform_event(self, data):
Expand Down

0 comments on commit ff853b3

Please sign in to comment.