|
@ -236,14 +236,15 @@ class SteamClient(CMClient, BuiltinBase): |
|
|
def wait_msg(self, event, timeout=None, raises=None): |
|
|
def wait_msg(self, event, timeout=None, raises=None): |
|
|
"""Wait for a message, similiar to :meth:`.wait_event` |
|
|
"""Wait for a message, similiar to :meth:`.wait_event` |
|
|
|
|
|
|
|
|
:param event: :class:`.EMsg' or job id |
|
|
:param event: event id |
|
|
|
|
|
:type event: :class:`.EMsg` or job id |
|
|
:param timeout: seconds to wait before timeout |
|
|
:param timeout: seconds to wait before timeout |
|
|
:type timeout: :class:`int` |
|
|
:type timeout: :class:`int` |
|
|
:param raises: On timeout when ``False` returns :class:`None`, else raise :class:`gevent.Timeout` |
|
|
:param raises: On timeout when ``False`` returns :class:`None`, else raise :class:`gevent.Timeout` |
|
|
:type raises: :class:`bool` |
|
|
:type raises: :class:`bool` |
|
|
:return: returns a message or :class:`None` |
|
|
:return: returns a message or :class:`None` |
|
|
:rtype: :class:`None`, or `proto message` |
|
|
:rtype: :class:`None`, or `proto message` |
|
|
:raises: ``gevent.Timeout`` |
|
|
:raises: :class:`gevent.Timeout` |
|
|
""" |
|
|
""" |
|
|
resp = self.wait_event(event, timeout, raises) |
|
|
resp = self.wait_event(event, timeout, raises) |
|
|
|
|
|
|
|
@ -251,8 +252,7 @@ class SteamClient(CMClient, BuiltinBase): |
|
|
return resp[0] |
|
|
return resp[0] |
|
|
|
|
|
|
|
|
def send(self, message, body_params=None): |
|
|
def send(self, message, body_params=None): |
|
|
""".. versionchanged:: 0.8.4 |
|
|
"""Send a message to CM |
|
|
Send a message to CM |
|
|
|
|
|
|
|
|
|
|
|
:param message: a message instance |
|
|
:param message: a message instance |
|
|
:type message: :class:`.Msg`, :class:`.MsgProto` |
|
|
:type message: :class:`.Msg`, :class:`.MsgProto` |
|
@ -268,8 +268,7 @@ class SteamClient(CMClient, BuiltinBase): |
|
|
CMClient.send(self, message) |
|
|
CMClient.send(self, message) |
|
|
|
|
|
|
|
|
def send_job(self, message, body_params=None): |
|
|
def send_job(self, message, body_params=None): |
|
|
""".. versionchanged:: 0.8.4 |
|
|
"""Send a message as a job |
|
|
Send a message as a job |
|
|
|
|
|
|
|
|
|
|
|
.. note:: |
|
|
.. note:: |
|
|
Not all messages are jobs, you'll have to find out which are which |
|
|
Not all messages are jobs, you'll have to find out which are which |
|
@ -305,8 +304,7 @@ class SteamClient(CMClient, BuiltinBase): |
|
|
return "job_%d" % jobid |
|
|
return "job_%d" % jobid |
|
|
|
|
|
|
|
|
def send_job_and_wait(self, message, body_params=None, timeout=None, raises=False): |
|
|
def send_job_and_wait(self, message, body_params=None, timeout=None, raises=False): |
|
|
""".. versionchanged:: 0.8.4 |
|
|
"""Send a message as a job and wait for the response. |
|
|
Send a message as a job and wait for the response. |
|
|
|
|
|
|
|
|
|
|
|
.. note:: |
|
|
.. note:: |
|
|
Not all messages are jobs, you'll have to find out which are which |
|
|
Not all messages are jobs, you'll have to find out which are which |
|
@ -317,11 +315,11 @@ class SteamClient(CMClient, BuiltinBase): |
|
|
:type body_params: dict |
|
|
:type body_params: dict |
|
|
:param timeout: (optional) seconds to wait |
|
|
:param timeout: (optional) seconds to wait |
|
|
:type timeout: :class:`int` |
|
|
:type timeout: :class:`int` |
|
|
:param raises: (optional) On timeout if ``False`` return ``None``, else raise ``gevent.Timeout`` |
|
|
:param raises: (optional) On timeout if ``False`` return ``None``, else raise :class:`gevent.Timeout` |
|
|
:type raises: :class:`bool` |
|
|
:type raises: :class:`bool` |
|
|
:return: response proto message |
|
|
:return: response proto message |
|
|
:rtype: :class:`.Msg`, :class:`.MsgProto` |
|
|
:rtype: :class:`.Msg`, :class:`.MsgProto` |
|
|
:raises: ``gevent.Timeout`` |
|
|
:raises: :class:`gevent.Timeout` |
|
|
""" |
|
|
""" |
|
|
job_id = self.send_job(message, body_params) |
|
|
job_id = self.send_job(message, body_params) |
|
|
response = self.wait_event(job_id, timeout, raises=raises) |
|
|
response = self.wait_event(job_id, timeout, raises=raises) |
|
@ -330,8 +328,7 @@ class SteamClient(CMClient, BuiltinBase): |
|
|
return response[0].body |
|
|
return response[0].body |
|
|
|
|
|
|
|
|
def send_message_and_wait(self, message, response_emsg, body_params=None, timeout=None, raises=False): |
|
|
def send_message_and_wait(self, message, response_emsg, body_params=None, timeout=None, raises=False): |
|
|
""".. versionchanged:: 0.8.4 |
|
|
"""Send a message to CM and wait for a defined answer. |
|
|
Send a message to CM and wait for a defined answer. |
|
|
|
|
|
|
|
|
|
|
|
:param message: a message instance |
|
|
:param message: a message instance |
|
|
:type message: :class:`.Msg`, :class:`.MsgProto` |
|
|
:type message: :class:`.Msg`, :class:`.MsgProto` |
|
@ -341,11 +338,11 @@ class SteamClient(CMClient, BuiltinBase): |
|
|
:type body_params: dict |
|
|
:type body_params: dict |
|
|
:param timeout: (optional) seconds to wait |
|
|
:param timeout: (optional) seconds to wait |
|
|
:type timeout: :class:`int` |
|
|
:type timeout: :class:`int` |
|
|
:param raises: (optional) On timeout if ``False`` return ``None``, else raise ``gevent.Timeout`` |
|
|
:param raises: (optional) On timeout if ``False`` return ``None``, else raise :class:`gevent.Timeout` |
|
|
:type raises: :class:`bool` |
|
|
:type raises: :class:`bool` |
|
|
:return: response proto message |
|
|
:return: response proto message |
|
|
:rtype: :class:`.Msg`, :class:`.MsgProto` |
|
|
:rtype: :class:`.Msg`, :class:`.MsgProto` |
|
|
:raises: ``gevent.Timeout`` |
|
|
:raises: :class:`gevent.Timeout` |
|
|
""" |
|
|
""" |
|
|
self.send(message, body_params) |
|
|
self.send(message, body_params) |
|
|
response = self.wait_event(response_emsg, timeout, raises=raises) |
|
|
response = self.wait_event(response_emsg, timeout, raises=raises) |
|
|