diff --git a/publisher/async.py b/publisher/async.py index 632dc4b..0bdddec 100644 --- a/publisher/async.py +++ b/publisher/async.py @@ -11,7 +11,7 @@ class AsyncPublisher(Publisher): - def publish(self, message: Message) -> str: + def publish(self, message: Message, timeout: float) -> str: # check the parameters of the request self._check_parameters(message) @@ -19,7 +19,8 @@ def publish(self, message: Message) -> str: request = grequests.post( self.mercure_hub, data=Publisher._get_form_data(message), - headers=self._get_request_headers() + headers=self._get_request_headers(), + timeout=timeout ) response = grequests.map([request]).pop(0) diff --git a/publisher/sync.py b/publisher/sync.py index 9cc487c..890f0af 100644 --- a/publisher/sync.py +++ b/publisher/sync.py @@ -11,7 +11,7 @@ class SyncPublisher(Publisher): - def publish(self, message: Message) -> str: + def publish(self, message: Message, timeout: float) -> str: # check the parameters of the request self._check_parameters(message) @@ -19,7 +19,8 @@ def publish(self, message: Message) -> str: response = requests.post( self.mercure_hub, Publisher._get_form_data(message), - headers=self._get_request_headers() + headers=self._get_request_headers(), + timeout=timeout ) if response.status_code == 403: