Add restart method

This commit is contained in:
Dan 2019-01-11 12:36:37 +01:00
parent 19b8f648d2
commit 07276e31b9
2 changed files with 11 additions and 0 deletions

View File

@ -13,6 +13,7 @@ Utilities
start
stop
restart
idle
run
add_handler

View File

@ -374,6 +374,16 @@ class Client(Methods, BaseClient):
return self
def restart(self):
"""Use this method to restart the Client.
Requires no parameters.
Raises:
``ConnectionError`` in case you try to restart a stopped Client.
"""
self.stop()
self.start()
def idle(self, stop_signals: tuple = (SIGINT, SIGTERM, SIGABRT)):
"""Blocks the program execution until one of the signals are received,
then gently stop the Client by closing the underlying connection.